added some ansible playbooks for experiments
This commit is contained in:
parent
93a8e11888
commit
69167a7904
5
ansible-playbooks/README.txt
Normal file
5
ansible-playbooks/README.txt
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
|
||||
|
||||
ansible-playbook add-user-group.yml --extra-vars "ansible_sudo_pass=<SUDO-PASSWORD-HERE>"
|
||||
ansible-playbook del-user-group.yml --extra-vars "ansible_sudo_pass=<SUDO-PASSWORD-HERE>"
|
7
ansible-playbooks/add-user-group.yml
Normal file
7
ansible-playbooks/add-user-group.yml
Normal file
@ -0,0 +1,7 @@
|
||||
- hosts: all
|
||||
remote_user: hyung-hwan
|
||||
tasks:
|
||||
- name: add user group 'tomcat'
|
||||
group: name=tomcat
|
||||
become: true
|
||||
become_method: sudo
|
7
ansible-playbooks/del-user-group.yml
Normal file
7
ansible-playbooks/del-user-group.yml
Normal file
@ -0,0 +1,7 @@
|
||||
- hosts: all
|
||||
remote_user: hyung-hwan
|
||||
tasks:
|
||||
- name: delete user group 'tomcat'
|
||||
group: name=tomcat state=absent
|
||||
become: true
|
||||
become_method: sudo
|
21
ansible-playbooks/find-on-all.yml
Normal file
21
ansible-playbooks/find-on-all.yml
Normal file
@ -0,0 +1,21 @@
|
||||
- hosts: all
|
||||
remote_user: hyung-hwan
|
||||
tasks:
|
||||
- name: test connection
|
||||
find:
|
||||
paths: /var/log
|
||||
size: '1000000'
|
||||
recurse: yes
|
||||
register: out
|
||||
|
||||
- name: print result
|
||||
debug:
|
||||
msg: "xxx: {{ item.path }}"
|
||||
with_items: "{{ out.files }}"
|
||||
|
||||
|
||||
## - debug: var=item.path
|
||||
## with_items: "{{ out.files }}"
|
||||
|
||||
## - debug: var=out.files
|
||||
|
23
ansible-playbooks/get-m4.yml
Normal file
23
ansible-playbooks/get-m4.yml
Normal file
@ -0,0 +1,23 @@
|
||||
- hosts: all
|
||||
remote_user: hyung-hwan
|
||||
tasks:
|
||||
- name: Download GNU m4-1.14-19
|
||||
get_url:
|
||||
url=https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz
|
||||
dest=/tmp/m4-1.14-19.tar.gz force=no
|
||||
|
||||
- name: Untar m4
|
||||
unarchive:
|
||||
src: /tmp/m4-1.14-19.tar.gz
|
||||
dest: /tmp/
|
||||
remote_src: yes
|
||||
|
||||
- name: Delete the m4 file downloaded
|
||||
file:
|
||||
path=/tmp/m4-1.14-19.tar.gz
|
||||
state=absent
|
||||
|
||||
- name: Delete the m4 directory
|
||||
file:
|
||||
path=/tmp/m4-1.4.19/
|
||||
state=absent
|
17
ansible-playbooks/ls-on-all.yml
Normal file
17
ansible-playbooks/ls-on-all.yml
Normal file
@ -0,0 +1,17 @@
|
||||
- hosts: all
|
||||
remote_user: hyung-hwan
|
||||
tasks:
|
||||
- name: run ls
|
||||
shell: ls -laF /etc
|
||||
register: out
|
||||
|
||||
# - name: print result
|
||||
# debug:
|
||||
# msg: "xxx: {{ out.stdout }}"
|
||||
|
||||
|
||||
- name: print result
|
||||
debug:
|
||||
msg: "xxx: {{ item }}"
|
||||
loop: "{{ out.stdout_lines }}"
|
||||
|
6
ansible-playbooks/ping-on-all.yml
Normal file
6
ansible-playbooks/ping-on-all.yml
Normal file
@ -0,0 +1,6 @@
|
||||
- hosts: all
|
||||
remote_user: hyung-hwan
|
||||
tasks:
|
||||
- name: test connection
|
||||
ping:
|
||||
|
Loading…
Reference in New Issue
Block a user