Primeros commits
This commit is contained in:
parent
e4e14e960a
commit
707b014ae9
8 changed files with 1954 additions and 18 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
.idea
|
.idea
|
||||||
ansible.cfg
|
ansible.cfg
|
||||||
Vault/
|
Vault/
|
||||||
|
.sudo_pass
|
|
@ -1,2 +1,2 @@
|
||||||
[ubuntu-lxd]
|
[ubuntu_lxd]
|
||||||
mps.org.uy
|
mps.org.uy ansible_ssh_port=8032
|
|
@ -1,9 +1,10 @@
|
||||||
- hosts: ubuntu-lxd
|
# ansible-playbook Playbooks/01-UBUNTU-LXD.yml -i Inventories/QA --ask-become-pass
|
||||||
|
|
||||||
|
- hosts: ubuntu_lxd
|
||||||
vars:
|
vars:
|
||||||
sudoers:
|
sudoers:
|
||||||
- renzo
|
|
||||||
- lxd
|
- lxd
|
||||||
gather_facts: false
|
gather_facts: true
|
||||||
tasks:
|
tasks:
|
||||||
#- ansible.builtin.include_role: name=new_sudoers_user
|
#- ansible.builtin.include_role: name=new_sudoers_user
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
|
@ -14,6 +15,17 @@
|
||||||
- "ansible"
|
- "ansible"
|
||||||
- "zfsutils-linux"
|
- "zfsutils-linux"
|
||||||
|
|
||||||
- ansible.builtin.include_role: name=init_lxd
|
- ansible.builtin.include_role:
|
||||||
#vars: lxd_init_yaml_config_path="myPath"
|
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
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
---
|
---
|
||||||
# defaults file for roles/init_lxd
|
# 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"
|
|
@ -1,16 +1,33 @@
|
||||||
---
|
---
|
||||||
# tasks file for roles/init_lxd
|
# tasks file for roles/init_lxd
|
||||||
- name: Install lxd
|
- name: Install lxd
|
||||||
|
become: true
|
||||||
ansible.builtin.snap:
|
ansible.builtin.snap:
|
||||||
name: lxd
|
name: lxd
|
||||||
classic: yes
|
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
|
## 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
|
become: true
|
||||||
ansible.builtin.shell: |
|
ansible.builtin.shell: |
|
||||||
cat <<EOF | lxd init --preseed
|
cat <<EOF | lxd init --preseed
|
||||||
{{ lookup('file', lxd_init_yaml_config_path) }}
|
{{ lookup('file', lxd_init_template_processed_path) }}
|
||||||
EOF
|
EOF
|
||||||
register: lxd_init_output
|
register: lxd_init_output
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
# --
|
# --
|
||||||
config:
|
config:
|
||||||
images.auto_update_interval: "0"
|
images.auto_update_interval: "15"
|
||||||
|
|
||||||
# --
|
# --
|
||||||
networks:
|
networks:
|
||||||
- config:
|
- config:
|
||||||
ipv4.address: 10.243.17.1/24
|
# IPv4
|
||||||
ipv4.nat: "true"
|
ipv4.nat: "true"
|
||||||
ipv6.address: fd42:7b93:f596:7786::1/64
|
ipv4.address: {{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}
|
||||||
|
# IPv6
|
||||||
ipv6.nat: "true"
|
ipv6.nat: "true"
|
||||||
description: ""
|
ipv6.address: {{ hostvars[inventory_hostname]['ansible_default_ipv6']['address'] }}
|
||||||
name: lxdbr0
|
name: lxdbr0
|
||||||
type: bridge
|
type: bridge
|
||||||
project: default
|
project: default
|
||||||
|
@ -17,11 +18,10 @@ networks:
|
||||||
# --
|
# --
|
||||||
storage_pools:
|
storage_pools:
|
||||||
- config:
|
- config:
|
||||||
size: 5GB
|
size: 20GB
|
||||||
source: /var/snap/lxd/common/lxd/disks/default.img
|
source: /var/snap/lxd/common/lxd/disks/default.img
|
||||||
description: ""
|
|
||||||
name: default
|
name: default
|
||||||
driver: btrfs
|
driver: zfs
|
||||||
|
|
||||||
# --
|
# --
|
||||||
profiles:
|
profiles:
|
1901
Playbooks/test.json
Normal file
1901
Playbooks/test.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
# Run 01
|
||||||
|
|
||||||
|
ansible-playbook Playbooks/01-UBUNTU-LXD.yml -i Inventories/QA -v [-t 'rollback']
|
Loading…
Add table
Reference in a new issue