Last active
August 9, 2018 19:22
-
-
Save cocampbe/5c34b6e37511bf569a3dec9a8433f687 to your computer and use it in GitHub Desktop.
Example of changing an ip address on a EL host using the ansible nmcli module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: server123 | |
gather_facts: no | |
become: yes | |
name: change network config prior to failover | |
tasks: | |
- block: | |
- nmcli: | |
type: ethernet | |
conn_name: 'eth0' | |
ip4: '192.168.99.34/24' | |
gw4: '192.168.99.1' | |
dns4: | |
- 8.8.8.8 | |
- 4.4.4.4 | |
state: present | |
- lineinfile: | |
path: /etc/hosts | |
regexp: '192.168.88.56' | |
line: '192.168.99.34 server123' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment