Created
February 9, 2024 09:40
-
-
Save zeitounator/06fd1f76c8f2b06dd7bef6b5f30741f4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$ cat test.yml | |
--- | |
- hosts: localhost | |
tasks: | |
- name: Write ip4 adrees in a file | |
ansible.builtin.lineinfile: | |
line: "My ip4 is: {{ ansible_enp5s0.ipv4.address }}" | |
dest: /tmp/test/toto.txt | |
create: true | |
$ ansible-playbook test.yml | |
PLAY [localhost] *********************************************************************************************************************************************************************************************************** | |
TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************** | |
ok: [localhost] | |
TASK [Write ip4 adrees in a file] ****************************************************************************************************************************************************************************************** | |
changed: [localhost] | |
PLAY RECAP ***************************************************************************************************************************************************************************************************************** | |
localhost : ok=2 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 | |
$ cat /tmp/test/toto.txt | |
My ip4 is: 192.168.0.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment