Browse Source

Mise au propre du role

master v0.1
Pierre Coimbra 1 year ago
parent
commit
8c4f91d5ea
Signed by: pcoimbra GPG Key ID: F9C449C78F6FAEE6
6 changed files with 28 additions and 25 deletions
  1. +9
    -1
      README.md
  2. +1
    -1
      defaults/main.yml
  3. +8
    -2
      tasks/config.yml
  4. +6
    -6
      tasks/create.yml
  5. +3
    -14
      tasks/install.yml
  6. +1
    -1
      tasks/main.yml

+ 9
- 1
README.md View File

@ -1,4 +1,4 @@
# ansible-role-create-ct
# Ansible Role - Create CT
Role Ansible pour créer des conteneurs LXC sous Proxmox.
@ -54,3 +54,11 @@ ct_storage: local-zfs
#ct_swap: 0
#ct_unprivileged: 1
```
### License
GPLv3
### Authors Informations
Mablr / Pierre Coimbra

+ 1
- 1
defaults/main.yml View File

@ -1,6 +1,6 @@
---
ansible_ssh_private_key_file: "ssh/tmp_key"
to_install: vim,net-tools,nmap,dnsutils,unattended-upgrades,apt-listchanges,wget,curl,git
to_install: sudo,vim,net-tools,nmap,dnsutils,unattended-upgrades,apt-listchanges,wget,curl,git
ct_cpus: 1
ct_ram: 512
ct_disk: 1


+ 8
- 2
tasks/config.yml View File

@ -1,13 +1,19 @@
- name: Apt proxy configuration
- name: config | apt proxy configuration
template:
src: "{{ apt_template }}"
dest: /etc/apt/apt.conf.d/01proxy
tags:
- apt-proxy
- name: Http proxy configuration
- name: config | http proxy configuration
template:
src: "{{ http_template }}"
dest: /root/.wgetrc
tags:
- http-proxy
- name: config | set timezone
timezone:
name: Europe/Paris
tags:
- time

tasks/create_start.yml → tasks/create.yml View File

@ -1,7 +1,7 @@
# tasks file for roles/create_ct
- include_vars: vars/pve_credentials.yml
- name: Create LXC container
- name: create | create LXC container
proxmox:
api_user: "{{ user_pve }}"
api_password: "{{ passwd_pve }}"
@ -26,8 +26,7 @@
tags:
- create
- name: Start Container
delegate_to: localhost
- name: create | start Container
proxmox:
api_user: "{{ user_pve }}"
api_password: "{{ passwd_pve }}"
@ -38,10 +37,11 @@
retries: 3
until: ct_ready is successful
delay: 5
delegate_to: localhost
tags:
- start
- name: Add host to ssh config
- name: create | add host to ssh config
template:
src: "{{ ssh_template }}"
dest: ../ssh/config.tmp
@ -49,7 +49,7 @@
tags:
- ssh
- name: Append ssh config
- name: create | append ssh config
shell: |
if ! grep -q "{{ ct_name }}" ../ssh/config; then
cat ../ssh/config.tmp >> ../ssh/config
@ -58,7 +58,7 @@
tags:
- ssh
- name: Remove temp file
- name: create | remove temp file
shell: rm ../ssh/config.tmp
delegate_to: localhost
tags:

+ 3
- 14
tasks/install.yml View File

@ -1,28 +1,17 @@
- name: Set timezone
timezone:
name: Europe/Paris
tags:
- time
- name: Apt Update
- name: install | apt upgrade
apt:
update_cache: yes
tags:
- upgrade
- name: Apt Upgrade
apt:
upgrade: dist
tags:
- upgrade
- name: Install utils
- name: install | install utils
apt:
pkg: "{{ to_install }}"
tags:
- install
- name: Unattended-Upgrades Activation
- name: install | unattended-upgrades activation
shell: |
echo unattended-upgrades unattended-upgrades/enable_auto_updates boolean true | debconf-set-selections
dpkg-reconfigure -f noninteractive unattended-upgrades


+ 1
- 1
tasks/main.yml View File

@ -1,4 +1,4 @@
- import_tasks: create_start.yml
- import_tasks: create.yml
tags: full-create
- import_tasks: config.yml


Loading…
Cancel
Save