This commit is contained in:
Ruben Blanco 2023-10-19 14:18:14 +02:00
parent 44073c224f
commit 918054ad2c
18 changed files with 0 additions and 135 deletions

View File

@ -1,8 +0,0 @@
[defaults]
forks=50
callbacks_enabled = timer, profile_tasks, profile_roles
host_key_checking = False
pipelining = True
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=60s

View File

@ -1,23 +0,0 @@
---
- hosts: "{{ hosts_servers }}"
gather_facts: no
vars:
key_to_add: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDXzZ9SOKE/2uuXEeiFmOyYG0qR0thjjfxylJxURFoXE2SnUqJI3ZPac2f3KK4fScHKpAnFL4OARHi8cLFI3Uwcn40GEvRBArmUrNnPdCIWk2YH8GYNNfbQkWfcXxOAwHsM7XMgiZ7PAp0nG4u2aO+1GWOTkczBaVZ53mIlSUXnfo+EYUMwheixBydHDSYmOU7JHEw5YggXt0wds0fbzVk1bT++EAIS705m/14AcpGpeJgWpviCLzkfJNe7sbyuQdTVuP2pP7KN/NgmQQPZdniKbYIf+wz3TfkHRTNtg+N86C48aWfTfRncHgFQI4tQnCFWxrbydRJL0lpg2sRqYXrXNGLRzofLJRtx5yP4F2G0R9XBBnA/WknqjiLw4DKC73tAkqSPTciIHqBsjNo0wI15fu63TGQz8hKDecqJOso5tTpSlofTdRtvgCaLLMogS4uUmj4QZYpQ+9SRBeS33CLD4DUUN8Oc7V5f3EK4/GZKfuBHAne1tfDZN0A5UKieyfE= awx.verdnatura.es
tasks:
- name: Add ssh pub keys AWX
ansible.posix.authorized_key:
user: root
key: "{{ key_to_add }}"
state: present
manage_dir: yes
- name: Another way to call known_hosts
ansible.builtin.known_hosts:
name: awx.verdnatura.es # or 10.9.8.77
key: awx.verdnatura.es ssh-rsa awx.verdnatura.es # some key gibberish
path: /root/.ssh/known_hosts
state: present

View File

@ -1,28 +0,0 @@
---
- hosts: "{{ hosts_servers }}"
gather_facts: no
vars:
key_to_add: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDXzZ9SOKE/2uuXEeiFmOyYG0qR0thjjfxylJxURFoXE2SnUqJI3ZPac2f3KK4fScHKpAnFL4OARHi8cLFI3Uwcn40GEvRBArmUrNnPdCIWk2YH8GYNNfbQkWfcXxOAwHsM7XMgiZ7PAp0nG4u2aO+1GWOTkczBaVZ53mIlSUXnfo+EYUMwheixBydHDSYmOU7JHEw5YggXt0wds0fbzVk1bT++EAIS705m/14AcpGpeJgWpviCLzkfJNe7sbyuQdTVuP2pP7KN/NgmQQPZdniKbYIf+wz3TfkHRTNtg+N86C48aWfTfRncHgFQI4tQnCFWxrbydRJL0lpg2sRqYXrXNGLRzofLJRtx5yP4F2G0R9XBBnA/WknqjiLw4DKC73tAkqSPTciIHqBsjNo0wI15fu63TGQz8hKDecqJOso5tTpSlofTdRtvgCaLLMogS4uUmj4QZYpQ+9SRBeS33CLD4DUUN8Oc7V5f3EK4/GZKfuBHAne1tfDZN0A5UKieyfE= awx@awx.verdnatura.es
user: awx1.verdnatura.es
tasks:
- name: Read authorized_keys file
shell: cat ~/.ssh/authorized_keys | grep "{{ user }}"
register: authorized_key_output
ignore_errors: yes
- name: Check if authorized key exists
set_fact:
authorized_key_exists: "{{ authorized_key_output.stdout_lines | length > 0 }}"
- name: Display result
debug:
msg: "Authorized key exists: {{ authorized_key_exists }}"
- name: Add ssh pub keys AWX
authorized_key:
user: root
key: "{{ key_to_add }}"
when: not authorized_key_exists | False

View File

@ -1,28 +0,0 @@
---
- hosts: "{{ hosts_servers }}"
gather_facts: no
vars:
key_to_add: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDXzZ9SOKE/2uuXEeiFmOyYG0qR0thjjfxylJxURFoXE2SnUqJI3ZPac2f3KK4fScHKpAnFL4OARHi8cLFI3Uwcn40GEvRBArmUrNnPdCIWk2YH8GYNNfbQkWfcXxOAwHsM7XMgiZ7PAp0nG4u2aO+1GWOTkczBaVZ53mIlSUXnfo+EYUMwheixBydHDSYmOU7JHEw5YggXt0wds0fbzVk1bT++EAIS705m/14AcpGpeJgWpviCLzkfJNe7sbyuQdTVuP2pP7KN/NgmQQPZdniKbYIf+wz3TfkHRTNtg+N86C48aWfTfRncHgFQI4tQnCFWxrbydRJL0lpg2sRqYXrXNGLRzofLJRtx5yP4F2G0R9XBBnA/WknqjiLw4DKC73tAkqSPTciIHqBsjNo0wI15fu63TGQz8hKDecqJOso5tTpSlofTdRtvgCaLLMogS4uUmj4QZYpQ+9SRBeS33CLD4DUUN8Oc7V5f3EK4/GZKfuBHAne1tfDZN0A5UKieyfE= awx@awx.verdnatura.es
user: awx.verdnatura.es
tasks:
- name: Read authorized_keys file
shell: cat ~/.ssh/authorized_keys | grep "{{ user }}"
register: authorized_key_output
ignore_errors: yes
- name: Check if authorized key exists
set_fact:
authorized_key_exists: "{{ authorized_key_output.stdout_lines | length > 0 }}"
- name: Display result
debug:
msg: "Authorized key exists: {{ authorized_key_exists }}"
- name: Add ssh pub keys AWX
authorized_key:
user: root
key: "{{ key_to_add }}"
when: not authorized_key_exists | False

View File

@ -1,14 +0,0 @@
---
- hosts: "{{ hosts_servers }}"
gather_facts: no
tasks:
- name: Create a ssh user in the system
user:
name: "{{ ssh_user_name }}"
password: "{{ ssh_password | password_hash('sha512') }}"
update_password: always
state: present
groups: sudo
shell: /bin/bash
comment: ssh user

View File

@ -1,8 +0,0 @@
---
- hosts: "{{ hosts_servers }}"
gather_facts: no
tasks:
- name: Package Installation
apt:
name: "{{ package_name }}"
state: present

View File

@ -1,10 +0,0 @@
---
- name: Obtener la versión del sistema operativo
hosts: "{{ hosts_servers }}"
gather_facts: yes
tasks:
- name: Mostrar la versión de Debian
debug:
msg: "OS is {{ ansible_distribution }} V. {{ ansible_distribution_version }} , {{ ansible_lsb.codename }}"

View File

@ -1,7 +0,0 @@
---
- name: Ping Linux hosts
hosts: "{{ hosts_servers }}"
tasks:
- name: Ping Linux hosts using ping module
ansible.builtin.ping:

View File

@ -1,9 +0,0 @@
---
- hosts: "{{ hosts_servers }}"
gather_facts: no
tasks:
- name: Package Uninstall
apt:
name: "{{ package_name }}"
state: absent
purge: true