chore 📦: Update setupacdc.yml to enable container provisioning
Updated the setupacdc.yml configuration to enable container provisioning for the addc_hostname. This change allows for more flexible and dynamic deployment of containers within the LXC environment.
This commit is contained in:
@@ -6,8 +6,7 @@
|
||||
become_user: root
|
||||
|
||||
vars:
|
||||
node_ip: "{{ hostvars['node0']['ansible_host'] }}"
|
||||
addc_hostname: "DC1"
|
||||
node_ip: "{{ hostvars['node0']['ansible_host'] }}"
|
||||
mac_address: "8E:90:31:DE:31:36"
|
||||
|
||||
container_id: 200
|
||||
@@ -54,3 +53,32 @@
|
||||
creates: "/etc/pve/lxc/{{ container_id }}.conf"
|
||||
|
||||
# -timezone: {{ localization_timezone }} \
|
||||
|
||||
- name: Start the LXC container {{ container_hostname }}
|
||||
ansible.builtin.command:
|
||||
cmd: pct start {{ container_id }}
|
||||
register: start_result
|
||||
changed_when: "'started' in start_result.stdout or start_result.rc == 0"
|
||||
|
||||
# - name: Wait for the container to get an IP address
|
||||
# ansible.builtin.shell: "pct exec {{ container_id }} -- hostname -I"
|
||||
# register: container_ip
|
||||
# until: container_ip.stdout != ""
|
||||
# retries: 10
|
||||
# delay: 5
|
||||
|
||||
# - name: Get container IP
|
||||
# ansible.builtin.shell: "pct exec {{ container_id }} -- hostname -I | awk '{print $1}'"
|
||||
# register: lxc_ip
|
||||
# changed_when: false
|
||||
|
||||
# - name: Add container to in-memory inventory
|
||||
# ansible.builtin.add_host:
|
||||
# name: "{{ container_hostname }}"
|
||||
# ansible_host: "{{ lxc_ip.stdout }}"
|
||||
# ansible_user: root
|
||||
|
||||
- name: Provision inside {{ addc_hostname }} LXC
|
||||
hosts: {{ addc_hostname }}
|
||||
gather_facts: false
|
||||
become: true
|
||||
Reference in New Issue
Block a user