Adding ansible playbooks

This commit is contained in:
2025-05-23 07:32:23 -04:00
parent a596274ca6
commit a466ded673
21 changed files with 295 additions and 0 deletions
BIN
View File
Binary file not shown.
View File
+1
View File
@@ -0,0 +1 @@
ansible ansible_host=192.168.128.92 ansible_port=22 ansible_user=wjones ansible_ssh_private_key_file=/home/wjones/.ssh/id_rsa
+29
View File
@@ -0,0 +1,29 @@
ansible ansible_host=192.168.128.92 ansible_port=22 ansible_user=wjones ansible_ssh_private_key_file=/Users/wjones/Projects/ansible/files/id_rsa
[debian_hosts]
gitlab.wpjones.com
pgserver.wpjones.com
plexserve1.wpjones.com
dhcpdns.wpjones.com
QDrive.wpjones.com
homeassistant.wpjones.com
homebridge.wpjones.com
firefly.wpjones.com
dockermain.wpjones.com
[pve_hosts]
pve.wpjones.com
pve2.wpjones.com
pve3.wpjones.com
[windows_hosts]
streamfab.wpjones.com
workstation.wpjones.com
qbit.wpjones.com
blueiris.wpjones.com
codeproject-ai.wpjones.com
[hosts:children]
pve_hosts
debian_hosts
+11
View File
@@ -0,0 +1,11 @@
all:
hosts:
gitlab.wpjones.com:
children:
cluster:
db:
hosts:
gitlab.wpjones.com:
windows:
hosts:
streamfab.wpjones.com:
+39
View File
@@ -0,0 +1,39 @@
-----BEGIN RSA PRIVATE KEY-----
MIIG4wIBAAKCAYEA2zq1G4kcCydcw2dwc2GTrP+my0dU9Ord7QmIWvSkXa8geyuW
SR4IvH3BtJysoqgq1N+hqiI0PdVf4uvun18Jb2gyCi7KCtr0UvKFAYx/YfitlCe0
NMK/NFzVMBjaxPMoo8EiGnY/b+oo+f7iGOuZFqblvk1zld8+iEgc61iKhzE4nKqE
AsyepbqhqaJCcD4WWuGvv/jppVtABJ8H1cakBZRk1hKW2zy14jweuqrgkGXQUOlS
UWAcqlSrxWc6sygE0M8TmYlI+mzpkNZpbPYnGzSlMsV7BTQF0FGHU/cUmr20CewN
n1z0IslgHr9WehdieLiDGFBxmTf87Mo4+bu2inBzoULyQvAoudIC6ARwZb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wv2FgbdoFoNQiIZxwHr5IZ/1Y
MUSKseQekuRCep/AxCmnw+viSfn3iLDfHDVwFB9D7P37yeo3tllTCa/zs3z2V2Ij
WPlkSJZxXNsChnTOfMazSxsIgwLNwDID4J8P84cCgcBMYnRZdJj+7fjsMZu4Kuq+
1J0Nyp7M83HPRoQSWknVQa3jdlUp315uZItJ1bcT6+Cl1p9XxSuvSLhcabIaxHWQ
iY8dRW+wx8GvZXjt1S8FIWLlU/p0sNIDQlaeaAz/tfir1MOgMK5npKboEeDLIIbY
DBlp17C2Ls0ipgT0Q14SivTe0UH0FOKdSAVz6n50shzKTcGq60WxKu5cIio1v3wd
eR/qjpZ0RrW0wxB+VEEyY1AqBYj5IO6EBVUYjaKchqECgcEAjC1Iu66aCGnQUVgF
9+QesDLomexXJeQeqOCCWqfw5FJHP7ToQ0F9D6qod5qSioQBj2gbxG2V8C1YE5En
C/b1b3tb1ViZRbzDpYwC0yAgdwBmthtvptzOsRljP8IBvecW/nGfZBQZ1cB6e1P/
yXzvEzv9zKllUDv5vThQH9Hd0x/Gt4p7jylVgQhR0C7i81RH+e9NCk5GPL27e4F6
sDGkkrm26xPMY5n52M87vCI8MYCIwjiMDrpEt0LLDBVr+Yn3AoHAVF2ONinoO3cg
aREapsjaaZT0wxIZWZt03CcZK4P3yc2euYkqk/7ydRXg05PzQbZn67UNF0/mxzkv
3PRXbZtbXlU3vBx3kh+MKzIPftlThMcCnlEAGbWULfPiVNnfoO0/mltPJCCYFXon
+fQutBdmVv8nB6ssBZLycumaweMPzrJGQ8TCUG4G8nPmM4S9Nh6cPL9tF+QQM8FO
KmWuhB274irhAbKDYaBwbyyhYRebszgnTIYGbHhpQqJhSieoIevj
-----END RSA PRIVATE KEY-----
+13
View File
@@ -0,0 +1,13 @@
- hosts: localhost
vars:
vault_token: hvs.H9fmVpHzMP9dDeMiI7dJIdeZ
vault_url: 'https://vault.wpjones.com'
db_password: "{{ lookup('hashi_vault', 'secret=secret/passwords/db:data token={{ vault_token }} url={{ vault_url }}') }}"
system_password: "{{ lookup('hashi_vault', 'secret=secret/passwords/system:data token={{ vault_token }} url={{ vault_url }}') }}"
tasks:
- name: Value for system_password
debug:
msg: "system_password: {{ system_password }}"
- name: Value for db_password
debug:
msg: "db_password: {{ db_password }}"
+34
View File
@@ -0,0 +1,34 @@
all:
hosts:
blueiris:
ansible_host: 192.168.128.75
ansible_user: wjones
ansible_password: jones4295
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_scheme: https
ansible_winrm_server_cert_validation: ignore
qbit:
ansible_host: 192.168.128.129
ansible_user: wjones
ansible_password: jones4295
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_scheme: https
ansible_winrm_server_cert_validation: ignore
streamfab:
ansible_host: 192.168.128.242
ansible_user: wjones
ansible_password: jones4295
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_scheme: https
ansible_winrm_server_cert_validation: ignore
codeproject-ai:
ansible_host: 192.168.128.221
ansible_user: wjones
ansible_password: jones4295
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_scheme: https
ansible_winrm_server_cert_validation: ignore
+9
View File
@@ -0,0 +1,9 @@
- hosts: ansible
remote_user: root
become: yes
tasks:
- name: Curl Dockermain
shell:
cmd: curl http://dockermain:800
register: curl
- debug: var=curl.stdout_lines
+39
View File
@@ -0,0 +1,39 @@
- hosts: ansible
remote_user: root
become: yes
tasks:
# - name: Install Apache
# apt:
# name: apache2
# state: present
# notify:
# - Restart Apache
# - name: Install nano
# apt:
# name: nano
# state: present
# notify:
# - Restart Apache
# - name: Install MySQL
# apt:
# name: mysql-server
# state: present
# notify:
# - Restart Apache
- name: Remove Apache
apt:
name: apache2*
state: absent
- name: Remove nano
apt:
name: nano
state: absent
- name: Remove MySQL
apt:
name: mysql*
state: absent
# handlers:
# - name: Restart Apache
# service:
# name: apache2
# state: restarted
+19
View File
@@ -0,0 +1,19 @@
- hosts: ansible
remote_user: root
become: yes
vars:
packages:
- apache2
- nano
- mysql-server
tasks:
- name: Install Software
apt:
name: "{{ item }}"
state: present
loop: "{{ packages }}"
- name: Remove Software
apt:
name: "{{ item }}"
state: absent
loop: "{{ packages }}"
+12
View File
@@ -0,0 +1,12 @@
- hosts: ansible
remote_user: root
become: yes
tasks:
- name: Install Apache
apt:
name: apache2
state: present
- name: Remove Apache
apt:
name: apache2
state: absent
View File
+16
View File
@@ -0,0 +1,16 @@
- hosts: ansible
remote_user: root
become: yes
tasks:
- name: Install Apache
apt:
name: apache2
state: present
- name: Restart Apache
service:
name: apache2
state: restarted
- name: Remove Apache
apt:
name: apache2
state: absent
+3
View File
@@ -0,0 +1,3 @@
- hosts: ansible
roles:
- vardemo
+11
View File
@@ -0,0 +1,11 @@
- hosts: ansible
vars_files:
- vars.yaml
tasks:
- name: Display 1st Value
debug:
msg: "{{ http_port }}"
- name: Display 2nd Value
debug:
msg: "{{ server_name }}"
# Can be used with the inline specification"
+10
View File
@@ -0,0 +1,10 @@
- hosts: ansible
vars:
courses:
- ansible
- terraform
- docker
tasks:
- name: Display Value
debug:
msg: "{{ courses [1] }}"
+7
View File
@@ -0,0 +1,7 @@
- hosts: ansible
vars:
basic_var: My First Variable
tasks:
- name: Display Value
debug:
msg: "{{ basic_var }}"
+2
View File
@@ -0,0 +1,2 @@
http_port: 80
server_name: ansible
+29
View File
@@ -0,0 +1,29 @@
- hosts: ansible
remote_user: root
become: yes
tasks:
- name: update packages
apt:
name: '*'
state: latest
register: apt
- debug: var=apt.stdout_lines
- name: Install Apache
apt:
name: apache2
state: present
register: apt
notify:
- Restart Apache
- debug: var=apt.stdout_lines
- name: Create index.html
shell: echo "Hello From The Ansible Challenge 2" > /var/www/html/index.html
args:
executable: /bin/bash
register: apt
- debug: var=apt.stdout_lines
handlers:
- name: Restart Apache
service:
name: apache2
state: reloaded