Copy name server info to all web servers
1. Disable NetworkManager service
[root@master ~]# systemctl status/stop/disable NetworkManager
2. Update your config file with correct dns entry
[root@master ~]# cat mydns.conf
nameserver {{ dnsip }}
3. Write your yaml file
[root@master ~]# cat mydns.yaml
- hosts: myweb
vars:
- dnsip: "8.8.8.8"
tasks:
- template:
src: mydns.conf
dest: /etc/resolv.conf
4. Check your ansible config file
[root@master ~]# ansible --version
config file = /etc/ansible/ansible.cfg
5. Find your inventory file
[root@master ~]# cat /etc/ansible/ansible.cfg | more
[defaults]
inventory = /root/myhosts
host_key_checking=false
6. Check your inventory record. Set up passwordless authentication (ssh-keygen)
[root@master ~] # cat myhosts
[myweb]
worker1 ansible_user=root ansible_ssh_pass=changeme ansible_connection=ssh
worker2 ansible_user=root ansible_ssh_pass=changeme ansible_connection=ssh
7. Run your playbook
[root@master ~]# ansible-playbook mydns.yaml
Monday, December 7, 2020
Ansible - update / copy file using jinja template
Subscribe to:
Post Comments (Atom)
Git branch show detached HEAD
Git branch show detached HEAD 1. List your branch $ git branch * (HEAD detached at f219e03) 00 2. Run re-set hard $ git reset --hard 3. ...
-
snmpconfig command allow you to managge snmpv1/v3 agent configuration on SAN switch. Event trap level is mapped with event severity level....
-
Firmware upgrade on HPE SuperDom Flex 280 - prerequisites tasks a. Set up repo b. Upload firmware to your webserver 1. For foundation so...
-
Disabling the Telnet protocol on Brocade SAN switches By default, telnet is enabled on Brocade SAN switches. As part of security hardening o...
No comments:
Post a Comment