fix al container. ora va per davvero e ci sono le password in un .env.yml
This commit is contained in:
parent
75dfd49a53
commit
5941ed27b2
9 changed files with 35 additions and 20 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,3 +1,6 @@
|
||||||
|
# passwords
|
||||||
|
.env.yml
|
||||||
|
|
||||||
# ---> Ansible
|
# ---> Ansible
|
||||||
*.retry
|
*.retry
|
||||||
|
|
||||||
|
|
@ -39,4 +42,3 @@ override.tf.json
|
||||||
# Ignore CLI configuration files
|
# Ignore CLI configuration files
|
||||||
.terraformrc
|
.terraformrc
|
||||||
terraform.rc
|
terraform.rc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ Teniamo libero il 10.10.0.21 per il povero container che sta venendo abbattuto e
|
||||||
|
|
||||||
`ansible-galaxy collection install -r requirements.yml`
|
`ansible-galaxy collection install -r requirements.yml`
|
||||||
|
|
||||||
|
In più, bisogna creare un file `.env.yml` nella root del progetto con questo template
|
||||||
|
`
|
||||||
|
PROXMOX_PASSWORD: "segretissima0"
|
||||||
|
XMPP_PASSWORD: "segretissima1"
|
||||||
|
`
|
||||||
|
|
||||||
### Per dare vita al container e alla configurazione di Prosody
|
### Per dare vita al container e alla configurazione di Prosody
|
||||||
#### _mado quanto è swag sta cosa_
|
#### _mado quanto è swag sta cosa_
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
# Variabili per la creazione del container
|
# Variabili per la creazione del container
|
||||||
root_password: "{{ lookup('env', 'XMPP_PASSWORD') }}"
|
# root_password: "{{ lookup('env', 'XMPP_PASSWORD') }}" #dovrebbe essere nel file .env
|
||||||
ssh_public_key: "{{ lookup('file', '~/.ssh/ansible.pub') }}"
|
ssh_public_key: "{{ lookup('file', '~/.ssh/ansible.pub') }}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
proxmox_host: 192.168.1.100:8006
|
proxmox_host: 192.168.1.100:8006
|
||||||
proxmox_user: root@pam
|
proxmox_user: root@pam
|
||||||
proxmox_password: "{{ lookup('env', 'PROXMOX_PASSWORD') }}"
|
# proxmox_password: "{{ lookup('env', 'PROXMOX_PASSWORD') }}" #dovrebbe essere nel file .env
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
- name: Configura container LXC
|
- name: Configura container LXC
|
||||||
hosts: lxc_containers
|
hosts: lxc_containers
|
||||||
|
gather_facts: false
|
||||||
|
become: true
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- ../.env.yml
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
ssh_public_key: "{{ lookup('file', '~/.ssh/ansible.pub') }}"
|
ssh_public_key: "{{ lookup('file', '~/.ssh/ansible.pub') }}"
|
||||||
gather_facts: false
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Wait until SSH is fully ready (Ansible login confirms availability)
|
- name: Wait until SSH is fully ready (Ansible login confirms availability)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
- name: Configura Prosody (xmpp) sul container
|
- name: Configura Prosody (xmpp) sul container
|
||||||
hosts: lxc_containers
|
hosts: lxc_containers
|
||||||
|
vars_files:
|
||||||
|
- ../.env.yml
|
||||||
roles:
|
roles:
|
||||||
- prosody
|
- prosody
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
- name: Crea container lxc per prosody (xmpp)
|
- name: Crea container lxc per prosody (xmpp)
|
||||||
hosts: proxmox_nodes
|
hosts: proxmox_nodes
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
|
||||||
|
vars_files:
|
||||||
|
- ../.env.yml
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
root_password: "{{ lookup('env', 'XMPP_PASSWORD') }}"
|
# root_password: "{{ lookup('env', 'XMPP_PASSWORD') }}" #dovrebbe essere nel file .env
|
||||||
ssh_public_key: "{{ lookup('file', '~/.ssh/ansible.pub') }}"
|
ssh_public_key: "{{ lookup('file', '~/.ssh/ansible.pub') }}"
|
||||||
vmid: 121
|
vmid: 121
|
||||||
|
|
||||||
|
|
@ -11,7 +15,7 @@
|
||||||
community.general.proxmox:
|
community.general.proxmox:
|
||||||
api_host: "{{ proxmox_url }}"
|
api_host: "{{ proxmox_url }}"
|
||||||
api_user: "{{ proxmox_user }}"
|
api_user: "{{ proxmox_user }}"
|
||||||
api_password: "{{ proxmox_password }}"
|
api_password: "{{ PROXMOX_PASSWORD }}"
|
||||||
vmid: "{{ vmid }}"
|
vmid: "{{ vmid }}"
|
||||||
node: milan
|
node: milan
|
||||||
hostname: xmpp
|
hostname: xmpp
|
||||||
|
|
@ -22,7 +26,7 @@
|
||||||
netif:
|
netif:
|
||||||
net0: "name=eth0,bridge=vmbr1,ip=10.10.0.21/16,gw=10.10.0.1"
|
net0: "name=eth0,bridge=vmbr1,ip=10.10.0.21/16,gw=10.10.0.1"
|
||||||
pubkey: "{{ ssh_public_key }}"
|
pubkey: "{{ ssh_public_key }}"
|
||||||
password: "{{ root_password }}"
|
password: "{{ XMPP_PASSWORD }}"
|
||||||
features: "nesting=1"
|
features: "nesting=1"
|
||||||
state: present
|
state: present
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
|
|
@ -32,7 +36,7 @@
|
||||||
community.general.proxmox:
|
community.general.proxmox:
|
||||||
api_host: "{{ proxmox_url }}"
|
api_host: "{{ proxmox_url }}"
|
||||||
api_user: "{{ proxmox_user }}"
|
api_user: "{{ proxmox_user }}"
|
||||||
api_password: "{{ proxmox_password }}"
|
api_password: "{{ PROXMOX_PASSWORD }}"
|
||||||
vmid: "{{ vmid }}"
|
vmid: "{{ vmid }}"
|
||||||
node: milan
|
node: milan
|
||||||
state: started # Tutto questo blocco è riassumibile in questa riga
|
state: started # Tutto questo blocco è riassumibile in questa riga
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
prosody_domain: "xmpp.hackinpovo.it"
|
prosody_domain: "xmpp.hackinpovo.it"
|
||||||
prosody_admin: "admin@{{ prosody_domain }}"
|
prosody_admin: "admin@{{ prosody_domain }}"
|
||||||
prosody_package: prosody
|
prosody_package: prosody
|
||||||
xmpp_admin_password: "{{ lookup('env', 'XMPP_ADMIN_PASSWORD') }}"
|
# xmpp_admin_password: "{{ lookup('env', 'XMPP_PASSWORD') }}" # Dovrebbe essere nel file .env.yml
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,9 @@
|
||||||
state: started
|
state: started
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
||||||
- name: Create XMPP admin user
|
- name: Create XMPP admin user non-interactively
|
||||||
ansible.builtin.expect:
|
ansible.builtin.command:
|
||||||
command: prosodyctl adduser admin@{{ xmpp_domain }}
|
cmd: prosodyctl register admin {{ prosody_domain }} {{ XMPP_PASSWORD }}
|
||||||
responses:
|
args:
|
||||||
"Enter new password:": "{{ xmpp_admin_password }}"
|
creates: "/var/lib/prosody/{{ prosody_domain }}/accounts/admin.dat"
|
||||||
"Retype new password:": "{{ xmpp_admin_password }}"
|
become: yes
|
||||||
become: yes
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue