当前位置:网站首页>Goldfish rhca memoirs: do447 management list -- Chapter experiment

Goldfish rhca memoirs: do447 management list -- Chapter experiment

2022-06-09 21:02:00 Hua Weiyun

Personal profile : Hello everyone , I am a Brother goldfish ,CSDN New star creator in operation and maintenance field , Hua Wei Yun · Cloud sharing experts , Alicloud community · Expert bloggers
Personal qualifications :CCNA、HCNP、CSNA( Network Analyst ), Soft test primary 、 Intermediate network engineer 、RHCSA、RHCE、RHCA、RHCI、ITIL
Maxim : Hard work doesn't necessarily succeed , But if you want to succeed, you must work hard


[[email protected] ~]$ lab inventory-review start


Pull experiment code

[[email protected] ~]$ cd git-repos/[[email protected] git-repos]$ git clone http://git.lab.example.com:8081/git/inventory-review.gitCloning into 'inventory-review'...remote: Enumerating objects: 56, done.remote: Counting objects: 100% (56/56), done.remote: Compressing objects: 100% (42/42), done.remote: Total 56 (delta 5), reused 0 (delta 0)Unpacking objects: 100% (56/56), done.[[email protected] git-repos]$ cd inventory-review

Run the script and verify

[[email protected] inventory-review]$ cat inventory [lb_servers]servera.lab.example.com[web_servers][web_servers:children]a_web_serversb_web_servers# Group "A" of Web Servers[a_web_servers]serverb.lab.example.com# Group "B" of Web Servers[b_web_servers]serverc.lab.example.com[[email protected] inventory-review]$ ansible-playbook site.yml[[email protected] inventory-review]$ curl http://serveraHello from serverb.lab.example.com. (version v1.1)[[email protected] inventory-review]$ curl http://serveraHello from serverc.lab.example.com. (version v1.1)

Create host group variables as required

[[email protected] inventory-review]$ mkdir -pv group_vars/{a,b}_web_serversmkdir: created directory 'group_vars/a_web_servers'mkdir: created directory 'group_vars/b_web_servers'[[email protected] inventory-review]$ echo "webapp_version: v1.1a" > group_vars/a_web_servers/webapp.yml[[email protected] inventory-review]$ echo "webapp_version: v1.1b" > group_vars/b_web_servers/webapp.yml

Run the script and verify

[[email protected] inventory-review]$ ansible-playbook deploy_webapp.yml[[email protected] inventory-review]$ curl http://serveraHello from serverb.lab.example.com. (version v1.1a)[[email protected] inventory-review]$ curl http://serveraHello from serverc.lab.example.com. (version v1.1b)

Submit changes to workspace

[[email protected] inventory-review]$ git statusOn branch masterYour branch is up to date with 'origin/master'.Untracked files:  (use "git add <file>..." to include in what will be committed)	group_vars/a_web_servers/	group_vars/b_web_servers/nothing added to commit but untracked files present (use "git add" to track)[[email protected] inventory-review]$ git add group_vars/{a,b}_web_servers[[email protected] inventory-review]$ git statusOn branch masterYour branch is up to date with 'origin/master'.Changes to be committed:  (use "git reset HEAD <file>..." to unstage)	new file:   group_vars/a_web_servers/webapp.yml	new file:   group_vars/b_web_servers/webapp.yml[[email protected] inventory-review]$ git commit -m "Created variable files for the A and B groups."[master 05c2080] Created variable files for the A and B groups. 2 files changed, 2 insertions(+) create mode 100644 group_vars/a_web_servers/webapp.yml create mode 100644 group_vars/b_web_servers/webapp.yml

To write yaml Manifest file and test execution

[[email protected] inventory-review]$ cat inventory.yml lb_servers:  hosts:    servera.lab.example.com:web_servers:  children:    a_web_servers:      hosts:        serverb.lab.example.com:    b_web_servers:      hosts:        serverc.lab.example.com:[[email protected] inventory-review]$ ansible-playbook site.yml -i inventory.yml

Rewrite as a variable, identify the host and test run

[[email protected] inventory-review]$ cat inventory.yml lb_servers:  hosts:    loadbalancer_1:      ansible_host: servera.lab.example.comweb_servers:  children:    a_web_servers:      hosts:        backend_a1:          ansible_host: serverb.lab.example.com    b_web_servers:      hosts:        backend_b1:          ansible_host: serverc.lab.example.com[[email protected] inventory-review]$ ansible-playbook site.yml -i inventory.yml

Submit the modified code project

[[email protected] inventory-review]$ git add inventory.yml[[email protected] inventory-review]$ git commit -m "Added YAML inventory"[master 3fc697d] Added YAML inventory 1 file changed, 15 insertions(+) create mode 100644 inventory.yml[[email protected] inventory-review]$ git statusOn branch masterYour branch is ahead of 'origin/master' by 2 commits.  (use "git push" to publish your local commits)nothing to commit, working tree clean[[email protected] inventory-review]$ git pushEnumerating objects: 12, done.Counting objects: 100% (12/12), done.Delta compression using up to 4 threads.Compressing objects: 100% (6/6), done.Writing objects: 100% (10/10), 920 bytes | 920.00 KiB/s, done.Total 10 (delta 2), reused 0 (delta 0)To http://git.lab.example.com:8081/git/inventory-review.git   e1de24a..3fc697d  master -> master

Evaluation and elimination experiment

[[email protected] inventory-review]$ lab inventory-review grade[[email protected] inventory-review]$ lab inventory-review finish

summary

RHCA Certification requires experience 5 Study and examination of the door , It still takes a lot of time to study and prepare for the exam , Come on , Can GA 🤪.

That's all 【 Brother goldfish 】 Yes Chapter two Management list – Chapter experiment Brief introduction and explanation of . I hope it can be helpful to the little friends who see this article .

Red hat Certification Column series :
RHCSA special column : entertain RHCSA authentication
RHCE special column : entertain RHCE authentication
This article is included in RHCA special column :RHCA memoir

If this article 【 article 】 It helps you , I hope I can give 【 Brother goldfish 】 Point a praise , It's not easy to create , Compared with the official statement , I prefer to use 【 Easy to understand 】 To explain every point of knowledge with your writing .

If there is a pair of 【 Operation and maintenance technology 】 Interested in , You are welcome to pay attention to ️️️ 【 Brother goldfish 】️️️, I will bring you great 【 Harvest and surprise 】!

原网站

版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/160/202206091849467746.html