Primeros commits

This commit is contained in:
RDF 2022-07-17 01:24:18 -03:00
parent e4e14e960a
commit 707b014ae9
8 changed files with 1954 additions and 18 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea
ansible.cfg
Vault/
Vault/
.sudo_pass

View File

@ -1,2 +1,2 @@
[ubuntu-lxd]
mps.org.uy
[ubuntu_lxd]
mps.org.uy ansible_ssh_port=8032

View File

@ -1,9 +1,10 @@
- hosts: ubuntu-lxd
# ansible-playbook Playbooks/01-UBUNTU-LXD.yml -i Inventories/QA --ask-become-pass
- hosts: ubuntu_lxd
vars:
sudoers:
- renzo
- lxd
gather_facts: false
gather_facts: true
tasks:
#- ansible.builtin.include_role: name=new_sudoers_user
- name: Install packages
@ -14,6 +15,17 @@
- "ansible"
- "zfsutils-linux"
- ansible.builtin.include_role: name=init_lxd
#vars: lxd_init_yaml_config_path="myPath"
- ansible.builtin.include_role:
name: init_lxd
#vars:
# - lxd_init_template_config_path="/path/to/my/template"
## Rollback
- hosts: ubuntu_lxd
tags:
- rollback
tasks:
- shell: "snap remove --purge lxd"
become: true

View File

@ -1,3 +1,4 @@
---
# defaults file for roles/init_lxd
lxd_init_yaml_config_path: "files/default_config.yml"
lxd_init_template_config_path: "templates/default_config.yml.j2"
lxd_init_template_processed_path: "/tmp/default_config.yml"

View File

@ -1,16 +1,33 @@
---
# tasks file for roles/init_lxd
- name: Install lxd
become: true
ansible.builtin.snap:
name: lxd
classic: yes
- ansible.builtin.debug:
var:
verbosity: 1
- delegate_to: localhost
delegate_facts: true
ansible.builtin.copy:
content: "{{hostvars[inventory_hostname]}}"
dest: ./test.json
- delegate_to: localhost
delegate_facts: true
ansible.builtin.template:
src: "{{lxd_init_template_config_path}}"
dest: "{{lxd_init_template_processed_path}}"
## tira el lxd init con los parametros
- name: "Preseeding LXD Init with: {{lxd_init_yaml_config_path}}"
- name: "Preseeding LXD Init with template: {{lxd_init_template_config_path}}"
become: true
ansible.builtin.shell: |
cat <<EOF | lxd init --preseed
{{ lookup('file', lxd_init_yaml_config_path) }}
{{ lookup('file', lxd_init_template_processed_path) }}
EOF
register: lxd_init_output

View File

@ -1,15 +1,16 @@
# --
config:
images.auto_update_interval: "0"
images.auto_update_interval: "15"
# --
networks:
- config:
ipv4.address: 10.243.17.1/24
# IPv4
ipv4.nat: "true"
ipv6.address: fd42:7b93:f596:7786::1/64
ipv4.address: {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
# IPv6
ipv6.nat: "true"
description: ""
ipv6.address: {{ hostvars[inventory_hostname]['ansible_default_ipv6']['address'] }}
name: lxdbr0
type: bridge
project: default
@ -17,11 +18,10 @@ networks:
# --
storage_pools:
- config:
size: 5GB
size: 20GB
source: /var/snap/lxd/common/lxd/disks/default.img
description: ""
name: default
driver: btrfs
driver: zfs
# --
profiles:

1901
Playbooks/test.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
# Run 01
ansible-playbook Playbooks/01-UBUNTU-LXD.yml -i Inventories/QA -v [-t 'rollback']