Du kan inte välja fler än 25 ämnen
Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
|
- ---
-
- - hosts: lxd_containers
- remote_user: root
- gather_facts: false
- vars:
- lxd_container_source:
- type: image
- mode: pull
- server: https://images.linuxcontainers.org
- protocol: lxd
- alias: debian/buster/amd64
- tasks:
- - name: lxd container installed and started
- community.general.lxd_container:
- name: "{{inventory_hostname}}"
- state: started
- source: "{{lxd_container_source}}"
- config: "{{lxd_container_config}}"
- profiles: ["default"]
- wait_for_ipv4_addresses: true
- timeout: 600
- delegate_to: "{{ lxd_host }}"
- - name: install python3 in lxd container
- command: lxc exec {{inventory_hostname}} -- apt-get -y install python3
- delegate_to: "{{ lxd_host }}"
-
- - hosts: lxd_containers
- remote_user: root
- connection: lxc_ssh
- gather_facts: false
- vars:
- ansible_host: "{{lxd_host}}"
- ansible_ssh_extra_args: "{{inventory_hostname}}"
- ssh_ip: "{{ansible_default_ipv6.address}}"
- tasks:
- - setup:
- - name: openssh server
- apt:
- pkg: openssh-server
- - name: make sure host_vars directory is present for host
- local_action: file
- args:
- path: "{{inventory_dir}}/host_vars/{{inventory_hostname}}"
- state: directory
- - name: record lxd containers IPv6 address for connection in host_vars
- local_action: copy
- args:
- content:
- ansible_host: "{{ssh_ip}}"
- ssh_ip: "{{ssh_ip}}"
- dest: "{{inventory_dir}}/host_vars/{{inventory_hostname}}/lxd_host.auto.json"
- - import_role:
- name: root_user
- - import_role:
- name: ssh_host_key
-
- - hosts: lxd_containers
- remote_user: root
|