-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook-copy2.yml
38 lines (34 loc) · 1.13 KB
/
playbook-copy2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
- name: Copying content from controller to hosts
hosts: planetexpress:!farnsworth
connection: ssh
gather_facts: true # default is true
tasks:
- name: Create the new group for ipv4 access
ansible.builtin.group:
name: sysadmin
state: present
become: yes
- name: Create a sysadmin user for ipv4 access
ansible.builtin.user:
name: admin1
comment: "Example Admin"
state: present
shell: /bin/bash
system: no
createhome: yes
group: sysadmin
become: yes
- name: Copy gather fact var data into hosts
ansible.builtin.copy:
content: "{{ ansible_all_ipv4_addresses }}" # facts gathered from host
dest: /home/admin1/ipv4info.txt # home directory on hosts
backup: yes # make backup of original
force: yes # file always copied when content is diff
owner: admin1 # set the owner (chown) of the file
group: sysadmin # set the group of the file
mode: '0644' # set the access permissions of the file
# mode can also be formatted as follows:
# mode: u=rw,g=r,o=r
# mode: u+rw,g-wx,o-wx
become: yes