-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhh_ansible.txt
105 lines (73 loc) · 2.82 KB
/
hh_ansible.txt
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Para simular una ejecucion (dry run)
ansible-playbook -vv -l ebi13 ebi.yml --diff --check
# Para ejecutar en una maquina en concreto
ansible-playbook -vv -l ebi13 ebi.yml --diff
# Para ejecutar en una maquina en concreto
ansible-playbook -vv --private-key /home/jsansaloni/.ssh/josanme/josanme.es -i ./inventory.ini -l 192.168.50.20 towerserver.yaml --diff
# Ejecutar las tasks con los siguientes tags
ansible-playbook example.yml --tags "configuration,packages"
# Ejecutar playbook evitando unos tags
ansible-playbook example.yml --skip-tags "packages"
# Ver lista de tasks con esos tags
ansible-playbook example.yml --tags "configuration,packages" --list-tasks
ansible-playbook example.yml --list-tags
---
# Tasks:
## mkdir
- name: mkdir directories
ansible.builtin.file:
path: "{{ item.path }}"
state: directory
owner: "{{ item.owner }}"
group: "{{ item.group }}"
mode: "{{ item.mode }}"
with_items:
- { path: "/usr/local/bin/scripts_correo", owner: "root", group: "root", mode: '0755' }
## link
- name: Enlaces simbólico desde /usr/local/bin/scripts_correo a /usr/local/bin/
ansible.builtin.file:
src: "/opt/jdk_8u202_setuid/jre/lib/amd64/jli/libjli.so"
dest: "/usr/lib64/libjli.so"
state: link
## Copy
- name: Creamos ficheros Vacios necesarios para los scripts
ansible.builtin.copy:
content: ""
dest: "{{ item.path }}"
group: "{{ item.group }}"
owner: "{{ item.owner }}"
force: no
mode: '0644'
with_items:
- { path: "/usr/local/cache/bajas.conf", owner: "root", group: "root" }
## Templates
- name: Copiamos los scripts que tenemos como Templates
ansible.builtin.template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: root
group: root
mode: '{{ item.mode }}'
with_items:
- { src: "usr/local/etc/check_cuota.conf.j2", dest: "/usr/local/etc/check_cuota.conf", mode: "0644" }
## PAQUETERIA
- name: Instalar Paquetes necesarios para los scripts
package:
name:
- rblcheck
state: present
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/systemd_module.html
# https://docs.ansible.com/ansible/latest/collections/ansible/builtin/copy_module.html
---
## WGET
# https://docs.ansible.com/ansible/latest/modules/get_url_module.html
- name: wget https://github.com/roundcube/roundcubemail/releases/download/1.4.9/roundcubemail-1.4.9-complete.tar.gz -O /tmp/roundcubemail-1.4.9-complete.tar.gz
ansible.builtin.get_url:
url: https://github.com/roundcube/roundcubemail/releases/download/1.4.9/roundcubemail-1.4.9-complete.tar.gz
dest: /tmp/roundcubemail-1.4.9-complete.tar.gz
## targz || unzip
- name: Extract /tmp/roundcubemail-1.4.9-complete.tar.gz into /var/www/html/
ansible.builtin.unarchive:
src: /tmp/roundcubemail-1.4.9-complete.tar.gz
dest: /var/www/html/
remote_src: yes