简体   繁体   中英

Script is getting stuck in the LXC init task

I'm a new user of ansible and I'm trying to launch a lxc init in a yaml script:

  - name: Copy LXC init file
  ansible.builtin.copy:
    src: /home/user/lxcInitFile.yaml
    dest: /tmp/
    owner: root
    group: root
    mode: '0644'

#- name: Destroy default zpool storage
#  command: zpool destroy default

- name: Launch LXC Initialization
  command: lxd init --preseed < /tmp/lxcInitFile.yaml
  debugger: always

My lxcInitFile.yaml file

config: {}
networks:
- config:
    ipv4.address: auto
    ipv6.address: none
  description: ""
  name: custom0
  type: ""
storage_pools:
- config:
    size: 5GB
  description: ""
  name: default
  driver: zfs
profiles:
- config: {}
  description: ""
  devices:
    eth0:
      name: eth0
      network: custom0
      type: nic
    root:
      path: /
      pool: default
      type: disk
  name: default
cluster: null

When I launch this with ansible, my script is getting stuck in the LXC init task, without debugging informations. If somebody have an idea it will be great.

I've changed

command: lxd init --preseed < /tmp/lxcInitFile.yaml

to

shell: lxd init --preseed < /tmp/lxcInitFile.yaml

and it's ok

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM