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 392 forks source link

Local Actions not working #896

Open zvonkok opened 6 years ago

zvonkok commented 6 years ago
ISSUE TYPE

services: local: from: centos:7 roles:

registries: {}

##### roles/local/tasks/main.yml

OS / ENVIRONMENT
Ansible Container, version 0.9.3rc0
Linux, ip-172-31-24-132.eu-central-1.compute.internal, 3.10.0-855.el7.x86_64, #1 SMP Tue Feb 20 06:46:45 EST 2018, x86_64
2.7.5 (default, Feb  9 2018, 09:51:13) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] /usr/bin/python2
{
  "ContainersPaused": 0, 
  "Labels": null, 
  "DefaultRuntime": "docker-runc", 
  "CgroupDriver": "systemd", 
  "ClusterAdvertise": "", 
  "ContainersRunning": 0, 
  "NGoroutines": 33, 
  "Swarm": {
    "Managers": 0, 
    "ControlAvailable": false, 
    "NodeID": "", 
    "Cluster": {
      "Spec": {
        "Raft": {}, 
        "CAConfig": {}, 
        "Dispatcher": {}, 
        "Orchestration": {}, 
        "TaskDefaults": {}
      }, 
      "Version": {}, 
      "ID": "", 
      "CreatedAt": "0001-01-01T00:00:00Z", 
      "UpdatedAt": "0001-01-01T00:00:00Z"
    }, 
    "Nodes": 0, 
    "Error": "", 
    "RemoteManagers": null, 
    "LocalNodeState": "inactive", 
    "NodeAddr": ""
  }, 
  "LoggingDriver": "json-file", 
  "OSType": "linux", 
  "HttpProxy": "", 
  "Runtimes": {
    "runc": {
      "path": "docker-runc"
    }, 
    "docker-runc": {
      "path": "/usr/libexec/docker/docker-runc-current"
    }
  }, 
  "DriverStatus": [
    [
      "Backing Filesystem", 
      "xfs"
    ], 
    [
      "Native Overlay Diff", 
      "true"
    ]
  ], 
  "OperatingSystem": "Red Hat Enterprise Linux Server 7.4 (Maipo)", 
  "Containers": 46, 
  "HttpsProxy": "", 
  "BridgeNfIp6tables": true, 
  "MemTotal": 128670912512, 
  "Driver": "overlay2", 
  "IndexServerAddress": "https://registry.reg-aws.openshift.com/v1/", 
  "ClusterStore": "", 
  "ExecutionDriver": "", 
  "Registries": [
    {
      "Name": "registry.reg-aws.openshift.com", 
      "Secure": false
    }, 
    {
      "Name": "brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888", 
      "Secure": false
    }, 
    {
      "Name": "registry.access.redhat.com", 
      "Secure": true
    }, 
    {
      "Name": "registry.access.redhat.com", 
      "Secure": true
    }, 
    {
      "Name": "docker.io", 
      "Secure": true
    }
  ], 
  "SystemStatus": null, 
  "OomKillDisable": true, 
  "PkgVersion": "docker-1.12.6-71.git3e8e77d.el7.x86_64", 
  "SystemTime": "2018-02-28T10:07:34.212481336Z", 
  "Name": "ip-172-31-24-132.eu-central-1.compute.internal", 
  "CPUSet": true, 
  "RegistryConfig": {
    "InsecureRegistryCIDRs": [
      "127.0.0.0/8"
    ], 
    "IndexConfigs": {
      "registry.access.redhat.com": {
        "Official": false, 
        "Name": "registry.access.redhat.com", 
        "Secure": true, 
        "Mirrors": []
      }, 
      "registry.reg-aws.openshift.com": {
        "Official": false, 
        "Name": "registry.reg-aws.openshift.com", 
        "Secure": false, 
        "Mirrors": []
      }, 
      "docker.io": {
        "Official": true, 
        "Name": "docker.io", 
        "Secure": true, 
        "Mirrors": null
      }, 
      "brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888": {
        "Official": false, 
        "Name": "brew-pulp-docker01.web.prod.ext.phx2.redhat.com:8888", 
        "Secure": false, 
        "Mirrors": []
      }
    }, 
    "Mirrors": null
  }, 
  "SecurityOptions": [
    "seccomp", 
    "selinux"
  ], 
  "ContainersStopped": 46, 
  "NCPU": 16, 
  "NFd": 22, 
  "Architecture": "x86_64", 
  "KernelMemory": true, 
  "CpuCfsQuota": true, 
  "Debug": false, 
  "IndexServerName": "registry.reg-aws.openshift.com", 
  "ID": "ORSW:M4NM:S62A:YYET:OZFD:XMUC:DIV6:DCR6:ZXKA:WBD7:GLQD:XZJO", 
  "IPv4Forwarding": true, 
  "KernelVersion": "3.10.0-855.el7.x86_64", 
  "BridgeNfIptables": true, 
  "NoProxy": "", 
  "LiveRestoreEnabled": false, 
  "ServerVersion": "1.12.6", 
  "CpuCfsPeriod": true, 
  "ExperimentalBuild": false, 
  "MemoryLimit": true, 
  "SwapLimit": true, 
  "Plugins": {
    "Volume": [
      "local"
    ], 
    "Network": [
      "null", 
      "bridge", 
      "host", 
      "overlay"
    ], 
    "Authorization": [
      "rhel-push-plugin"
    ]
  }, 
  "Images": 244, 
  "DockerRootDir": "/var/lib/docker", 
  "NEventsListener": 0, 
  "CPUShares": true
}
{
  "KernelVersion": "3.10.0-855.el7.x86_64", 
  "PkgVersion": "docker-1.12.6-71.git3e8e77d.el7.x86_64", 
  "Os": "linux", 
  "BuildTime": "2017-12-13T12:18:58.588069120-05:00", 
  "ApiVersion": "1.24", 
  "Version": "1.12.6", 
  "GitCommit": "3e8e77d/1.12.6", 
  "Arch": "amd64", 
  "GoVersion": "go1.8.3"
}
SUMMARY

Trying to delegate some tasks to localhost, which is not working.

fatal: [local]: FAILED! => {
    "changed": false,
    "module_stderr": "/bin/sh: /_usr/bin/python: No such file or directory\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE",
    "rc": 0
}
STEPS TO REPRODUCE
ansible-container build -- -vvv
EXPECTED RESULTS

A task from the playbook is executed on localhost rather than the container.

ACTUAL RESULTS

https://gist.github.com/zvonkok/0ed38605fe2b02ed69164938a780d60a

Voronenko commented 6 years ago

@zvonkok Can you provide objectives for such functionality? Assuming you have classic build via Dockerfile you also would not be able to execute action on the host system, if I am not mistaken.