Skip to content

Option "container_command" does not always work #22

@san199332

Description

@san199332

Option "container_command" does not always work:

container_command: |
echo "{{ ssh_pubkey_lxc }}" > /etc/openssh/authorized_keys/root

Debug:

(0, b'Exception ignored in: <function _after_at_fork_child_reinit_locks at 0x7feac03b8200>\r\nTraceback (most recent call last):\r\n File "/usr/lib64/python3.7/logging/init.py", line 258, in _after_at_fork_child_reinit_locks\r\n File "/usr/lib64/python3.7/logging/init.py", line 226, in _releaseLock\r\nRuntimeError: cannot release un-acquired lock\r\nTraceback (most recent call last):\r\n File "/tmp/.private/root/ansible_lxc_container_payload_bbmqz68a/ansible_lxc_container_payload.zip/ansible/modules/cloud/lxc/lxc_container.py", line 557, in create_script\r\n File "/usr/lib64/python3.7/tempfile.py", line 340, in mkstemp\r\n File "/usr/lib64/python3.7/tempfile.py", line 258, in _mkstemp_inner\r\nFileNotFoundError: [Errno 2] \xd0\x9d\xd0\xb5\xd1\x82 \xd1\x82\xd0\xb0\xd0\xba\xd0\xbe\xd0\xb3\xd0\xbe \xd1\x84\xd0\xb0\xd0\xb9\xd0\xbb\xd0\xb0 \xd0\xb8\xd0\xbb\xd0\xb8 \xd0\xba\xd0\xb0\xd1\x82\xd0\xb0\xd0\xbb\xd0\xbe\xd0\xb3\xd0\xb0: '/tmp/.private/root/lxc-attach-script_mu_0_72'\r\n\r\n{"changed": true, "lxc_container": {"interfaces": ["eth0", "lo"], "ips": ["10.88.5.155", "2a0c:88c0:2:400:216:3eff:fe04:3e77"], "state": "running", "init_pid": 3470, "name": "redmine"}, "invocation": {"module_args": {"name": "redmine", "container_log": true, "container_log_level": "DEBUG", "container_command": "echo \"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK2O9dl+1rAzssb7ARE3aWjxbzyt4/K2xwrjlC/Pp+jq [email protected]\" > /etc/openssh/authorized_keys/root\n", "template": "ubuntu", "backing_store": "dir", "vg_name": "lxc", "fs_type": "ext4", "fs_size": "5G", "state": "started", "clone_snapshot": false, "archive": false, "archive_compression": "gzip", "template_options": null, "config": null, "thinpool": null, "directory": null, "zfs_root": null, "lv_name": "redmine", "lxc_path": null, "container_config": null, "clone_name": null, "archive_path": null}}}\r\n', b'OpenSSH_7.9p1, OpenSSL 1.1.1g 21 Apr 2020\r\ndebug1: Reading configuration data /home/aas/.ssh/config\r\ndebug1: Reading configuration data /etc/openssh/ssh_config\r\ndebug1: /etc/openssh/ssh_config line 24: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 4 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 7525\r\ndebug3: mux_client_request_session: session request sent\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to lxctest closed.\r\n')

Please help me solve the problem.

$ ansible --version
ansible 2.9.15
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/aas/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.7.4 (default, Apr 17 2020, 12:15:50) [GCC 8.4.1 20200305 (ALT p9 8.4.1-alt0.p9.1)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions