ansible / ansible-container

DEPRECATED -- Ansible Container was a tool to build Docker images and orchestrate containers using only Ansible playbooks.
GNU Lesser General Public License v3.0
2.19k stars 394 forks source link

unreachable error while gathering facts on python 2.7 #774

Open kkoralsky opened 6 years ago

kkoralsky commented 6 years ago
ISSUE TYPE
container.yml
version: "2"
settings:
  conductor:
    base: debian:stretch
services:
  es:
    from: elasticsearch:2.2
    roles: [es]
OS / ENVIRONMENT
Ansible Container, version 0.9.3rc0
Linux, x220, 4.12.0-2-amd64, #1 SMP Debian 4.12.13-1 (2017-09-19), x86_64
2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170118] /home/koral/.virtualenvs/rl/bin/python2.7
{
  "ContainersPaused": 0,
  "Labels": null,
  "CgroupDriver": "cgroupfs",
  "ContainersRunning": 1,
  "ContainerdCommit": {
    "Expected": "06b9cb35161009dcb7123345749fef02f7cea8e0",
    "ID": "06b9cb35161009dcb7123345749fef02f7cea8e0"
  },
  "InitBinary": "docker-init",
  "NGoroutines": 32,
  "Swarm": {
    "ControlAvailable": false,
    "NodeID": "",
    "Error": "",
    "RemoteManagers": null,
    "LocalNodeState": "inactive",
    "NodeAddr": ""
  },
  "LoggingDriver": "json-file",
  "OSType": "linux",
  "HttpProxy": "",
  "Runtimes": {
    "runc": {
      "path": "docker-runc"
    }
  },
  "DriverStatus": [
    [
      "Pool Name",
      "docker-8:3-10100051-pool"
    ],
    [
      "Pool Blocksize",
      "65.54kB"
    ],
    [
      "Base Device Size",
      "10.74GB"
    ],
    [
      "Backing Filesystem",
      "ext4"
    ],
    [
      "Data file",
      "/dev/loop2"
    ],
    [
      "Metadata file",
      "/dev/loop3"
    ],
    [
      "Data Space Used",
      "76.82GB"
    ],
    [
      "Data Space Total",
      "107.4GB"
    ],
    [
      "Data Space Available",
      "30.55GB"
    ],
    [
      "Metadata Space Used",
      "75.4MB"
    ],
    [
      "Metadata Space Total",
      "2.147GB"
    ],
    [
      "Metadata Space Available",
      "2.072GB"
    ],
    [
      "Thin Pool Minimum Free Space",
      "10.74GB"
    ],
    [
      "Udev Sync Supported",
      "true"
    ],
    [
      "Deferred Removal Enabled",
      "true"
    ],
    [
      "Deferred Deletion Enabled",
      "true"
    ],
    [
      "Deferred Deleted Device Count",
      "0"
    ],
    [
      "Data loop file",
      "/var/lib/docker/devicemapper/devicemapper/data"
    ],
    [
      "Metadata loop file",
      "/var/lib/docker/devicemapper/devicemapper/metadata"
    ],
    [
      "Library Version",
      "1.02.142 (2017-07-20)"
    ]
  ],
  "OperatingSystem": "Debian GNU/Linux buster/sid",
  "Containers": 171,
  "HttpsProxy": "",
  "BridgeNfIp6tables": true,
  "MemTotal": 12479971328,
  "SecurityOptions": [
    "name=seccomp,profile=default"
  ],
  "Driver": "devicemapper",
  "IndexServerAddress": "https://index.docker.io/v1/",
  "ClusterStore": "",
  "InitCommit": {
    "Expected": "949e6fa",
    "ID": "949e6fa"
  },
  "GenericResources": null,
  "Isolation": "",
  "SystemStatus": null,
  "OomKillDisable": true,
  "ClusterAdvertise": "",
  "SystemTime": "2017-10-25T20:49:45.633592431+02:00",
  "Name": "x220",
  "CPUSet": true,
  "RegistryConfig": {
    "AllowNondistributableArtifactsCIDRs": [],
    "Mirrors": [],
    "IndexConfigs": {
      "10.0.0.10:5000": {
        "Official": false,
        "Name": "10.0.0.10:5000",
        "Secure": false,
        "Mirrors": []
      },
      "docker.io": {
        "Official": true,
        "Name": "docker.io",
        "Secure": true,
        "Mirrors": []
      }
    },
    "AllowNondistributableArtifactsHostnames": [],
    "InsecureRegistryCIDRs": [
      "127.0.0.0/8"
    ]
  },
  "DefaultRuntime": "runc",
  "ContainersStopped": 170,
  "NCPU": 4,
  "NFd": 25,
  "Architecture": "x86_64",
  "KernelMemory": true,
  "CpuCfsQuota": true,
  "Debug": false,
  "ID": "OONM:F4WZ:IB5T:3X7T:C3UV:MQAX:WM73:NNJO:DEPX:ND3U:45MB:5EXK",
  "IPv4Forwarding": true,
  "KernelVersion": "4.12.0-2-amd64",
  "BridgeNfIptables": true,
  "NoProxy": "",
  "LiveRestoreEnabled": false,
  "ServerVersion": "17.09.0-ce",
  "CpuCfsPeriod": true,
  "ExperimentalBuild": false,
  "MemoryLimit": true,
  "SwapLimit": true,
  "Plugins": {
    "Volume": [
      "local"
    ],
    "Network": [
      "bridge",
      "host",
      "macvlan",
      "null",
      "overlay"
    ],
    "Authorization": null,
    "Log": [
      "awslogs",
      "fluentd",
      "gcplogs",
      "gelf",
      "journald",
      "json-file",
      "logentries",
      "splunk",
      "syslog"
    ]
  },
  "Images": 226,
  "DockerRootDir": "/var/lib/docker",
  "NEventsListener": 0,
  "CPUShares": true,
  "RuncCommit": {
    "Expected": "3f2f8b84a77f73d38244dd690525642a72156c64",
    "ID": "3f2f8b84a77f73d38244dd690525642a72156c64"
  }
}
{
  "KernelVersion": "4.12.0-2-amd64",
  "Arch": "amd64",
  "BuildTime": "2017-09-26T22:40:48.000000000+00:00",
  "ApiVersion": "1.32",
  "Version": "17.09.0-ce",
  "MinAPIVersion": "1.12",
  "GitCommit": "afdb6d4",
  "Os": "linux",
  "GoVersion": "go1.8.3"
}
SUMMARY

I get UNREACHABLE error while gathering facts.

STEPS TO REPRODUCE
ansible-container init

fill container.yml w/ text above

fill ansible.cfg w/:

[defaults]
roles_path = ./roles
remote_tmp = /tmp
mkdir roles && cd roles && ansible-galaxy init es && cd ..
ansible-container --debug build 
EXPECTED RESULTS
ACTUAL RESULTS
<45a37b07bd6e2076281c68e21f2aa54bd7577d081bb2a44a676919b4e9c5889e> ESTABLISH DOCKER CONNECTION FOR USER: root
<45a37b07bd6e2076281c68e21f2aa54bd7577d081bb2a44a676919b4e9c5889e> EXEC ['/usr/local/bin/docker', 'exec', '-i', u'45a37b07bd6e2076281c68e21f2aa54bd7577d081bb2a44a676919b4e9c5889e', u'/bin/sh', '-c', u'/bin/sh -c \'( umask 77 && mkdir -p "` echo /tmp/ansible-tmp-1508958309.5-34940128315441 `" && echo ansible-tmp-1508958309.5-34940128315441="` echo /tmp/ansible-tmp-1508958309.5-34940128315441 `" ) && sleep 0\'']
fatal: [es]: UNREACHABLE! => {
    "changed": false,
    "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote temp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: ( umask 77 && mkdir -p \"` echo /tmp/ansible-tmp-1508958309.5-34940128315441 `\" && echo ansible-tmp-1508958309.5-34940128315441=\"` echo /tmp/ansible-tmp-1508958309.5-34940128315441 `\" ), exited with result 1, stderr output: Error response from daemon: Container 45a37b07bd6e2076281c68e21f2aa54bd7577d081bb2a44a676919b4e9c5889e is not running\n",
    "unreachable": true
}

https://gist.github.com/kkoralsky/4523960d418d9249be15b58c9cdd9393

kkoralsky commented 6 years ago

If i change conductor base to debian:jessie or container i want provision to elasticsearch:latest it will work. The thing is, that other containers in the same project I want to provision have to be based on debian:stretch. Would you consider to support option to override conductor base setting per container?

chouseknecht commented 6 years ago

The conduct base and the service from images need to line up, in terms of OS and OS version. This is because we're mounting the /usr and sometimes /lib directories from the conductor into the service container during build. Doing so alleviates the need to install a Python runtime in the service container.

Marking this as a feature idea.

orenyomtov commented 6 years ago

The option for overriding conductor base setting per container would solve a lot of problems for me as well.