{"action":"opened","issue":{"url":"https://api.github.com/repos/ansible/ansible-container/issues/596","repository_url":"https://api.github.com/repos/ansible/ansible-container","labels_url":"https://api.github.com/repos/ansible/ansible-container/issues/596/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-container/issues/596/comments","events_url":"https://api.github.com/repos/ansible/ansible-container/issues/596/events","html_url":"https://github.com/ansible/ansible-container/issues/596","id":235005139,"number":596,"title":"Variable ansible_env.ANSIBLE_CONTAINER undefined","user":{"login":"HackerMD","id":6855297,"avatar_url":"https://avatars1.githubusercontent.com/u/6855297?v=3","gravatar_id":"","url":"https://api.github.com/users/HackerMD","html_url":"https://github.com/HackerMD","followers_url":"https://api.github.com/users/HackerMD/followers","following_url":"https://api.github.com/users/HackerMD/following{/other_user}","gists_url":"https://api.github.com/users/HackerMD/gists{/gist_id}","starred_url":"https://api.github.com/users/HackerMD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackerMD/subscriptions","organizations_url":"https://api.github.com/users/HackerMD/orgs","repos_url":"https://api.github.com/users/HackerMD/repos","events_url":"https://api.github.com/users/HackerMD/events{/privacy}","received_events_url":"https://api.github.com/users/HackerMD/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-10T14:15:44Z","updated_at":"2017-06-10T14:15:44Z","closed_at":null,"body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\r\n\r\n##### ISSUE TYPE\r\n<!--- Pick one item below and delete the rest: -->\r\nBug Report\r\n\r\n##### container.yml \r\n<!--- Paste verbatim a copy of your container.yml between the quotes below -->\r\n```yaml\r\nversion: \"2\"\r\n\r\nsettings:\r\n  conductor_base: tissuemaps/base\r\n\r\nservices:\r\n  bar:\r\n    from: tissuemaps/base\r\n    roles:\r\n      - role: foo\r\n```\r\n\r\n##### roles/foo/tasks/main.yml\r\n```yaml\r\n- debug: msg={{ ansible_env.ANSIBLE_CONTAINER }}\r\n``` \r\n\r\n\r\n##### OS / ENVIRONMENT\r\n<!--- Paste output from `ansible-container --debug version` between the quotes below -->\r\n```\r\n\r\nAnsible Container, version 0.9.1\r\nDarwin, MacBook-Pro-4.local, 14.5.0, Darwin Kernel Version 14.5.0: Tue Apr 11 16:12:42 PDT 2017; root:xnu-2782.50.9.2.3~1/RELEASE_X86_64, x86_64\r\n2.7.11 (default, Jan 22 2016, 08:28:37)\r\n[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] /Users/mdh/Envs/deploy/bin/python2.7\r\n{\r\n  \"ContainersPaused\": 0,\r\n  \"Labels\": null,\r\n  \"CgroupDriver\": \"cgroupfs\",\r\n  \"ContainersRunning\": 1,\r\n  \"ContainerdCommit\": {\r\n    \"Expected\": \"4ab9917febca54791c5f071a9d1f404867857fcc\",\r\n    \"ID\": \"4ab9917febca54791c5f071a9d1f404867857fcc\"\r\n  },\r\n  \"InitBinary\": \"docker-init\",\r\n  \"NGoroutines\": 43,\r\n  \"Swarm\": {\r\n    \"Managers\": 0,\r\n    \"ControlAvailable\": false,\r\n    \"NodeID\": \"\",\r\n    \"Cluster\": {\r\n      \"Spec\": {\r\n        \"TaskDefaults\": {},\r\n        \"Orchestration\": {},\r\n        \"EncryptionConfig\": {\r\n          \"AutoLockManagers\": false\r\n        },\r\n        \"Raft\": {\r\n          \"HeartbeatTick\": 0,\r\n          \"ElectionTick\": 0\r\n        },\r\n        \"CAConfig\": {},\r\n        \"Dispatcher\": {}\r\n      },\r\n      \"Version\": {},\r\n      \"ID\": \"\",\r\n      \"CreatedAt\": \"0001-01-01T00:00:00Z\",\r\n      \"UpdatedAt\": \"0001-01-01T00:00:00Z\"\r\n    },\r\n    \"Nodes\": 0,\r\n    \"Error\": \"\",\r\n    \"RemoteManagers\": null,\r\n    \"LocalNodeState\": \"inactive\",\r\n    \"NodeAddr\": \"\"\r\n  },\r\n  \"LoggingDriver\": \"json-file\",\r\n  \"OSType\": \"linux\",\r\n  \"HttpProxy\": \"\",\r\n  \"Runtimes\": {\r\n    \"runc\": {\r\n      \"path\": \"docker-runc\"\r\n    }\r\n  },\r\n  \"DriverStatus\": [\r\n    [\r\n      \"Backing Filesystem\",\r\n      \"extfs\"\r\n    ],\r\n    [\r\n      \"Supports d_type\",\r\n      \"true\"\r\n    ],\r\n    [\r\n      \"Native Overlay Diff\",\r\n      \"true\"\r\n    ]\r\n  ],\r\n  \"OperatingSystem\": \"Alpine Linux v3.5\",\r\n  \"Containers\": 1,\r\n  \"HttpsProxy\": \"\",\r\n  \"BridgeNfIp6tables\": true,\r\n  \"MemTotal\": 6246776832,\r\n  \"SecurityOptions\": [\r\n    \"name=seccomp,profile=default\"\r\n  ],\r\n  \"Driver\": \"overlay2\",\r\n  \"IndexServerAddress\": \"https://index.docker.io/v1/\",\r\n  \"ClusterStore\": \"\",\r\n  \"InitCommit\": {\r\n    \"Expected\": \"949e6fa\",\r\n    \"ID\": \"949e6fa\"\r\n  },\r\n  \"Isolation\": \"\",\r\n  \"SystemStatus\": null,\r\n  \"OomKillDisable\": true,\r\n  \"ClusterAdvertise\": \"\",\r\n  \"SystemTime\": \"2017-06-10T14:14:07.328417937Z\",\r\n  \"Name\": \"moby\",\r\n  \"CPUSet\": true,\r\n  \"RegistryConfig\": {\r\n    \"InsecureRegistryCIDRs\": [\r\n      \"127.0.0.0/8\"\r\n    ],\r\n    \"IndexConfigs\": {\r\n      \"docker.io\": {\r\n        \"Official\": true,\r\n        \"Name\": \"docker.io\",\r\n        \"Secure\": true,\r\n        \"Mirrors\": null\r\n      }\r\n    },\r\n    \"Mirrors\": []\r\n  },\r\n  \"DefaultRuntime\": \"runc\",\r\n  \"ContainersStopped\": 0,\r\n  \"NCPU\": 4,\r\n  \"NFd\": 26,\r\n  \"Architecture\": \"x86_64\",\r\n  \"KernelMemory\": true,\r\n  \"CpuCfsQuota\": true,\r\n  \"Debug\": true,\r\n  \"ID\": \"KC7E:MCGC:TNHP:LBMN:ZPX7:F6AB:OIVT:7P4L:O3QX:5UOJ:C6MQ:YT45\",\r\n  \"IPv4Forwarding\": true,\r\n  \"KernelVersion\": \"4.9.27-moby\",\r\n  \"BridgeNfIptables\": true,\r\n  \"NoProxy\": \"*.local, 169.254/16\",\r\n  \"LiveRestoreEnabled\": false,\r\n  \"ServerVersion\": \"17.03.1-ce\",\r\n  \"CpuCfsPeriod\": true,\r\n  \"ExperimentalBuild\": false,\r\n  \"MemoryLimit\": true,\r\n  \"SwapLimit\": true,\r\n  \"Plugins\": {\r\n    \"Volume\": [\r\n      \"local\"\r\n    ],\r\n    \"Network\": [\r\n      \"bridge\",\r\n      \"host\",\r\n      \"macvlan\",\r\n      \"null\",\r\n      \"overlay\"\r\n    ],\r\n    \"Authorization\": null\r\n  },\r\n  \"Images\": 6,\r\n  \"DockerRootDir\": \"/var/lib/docker\",\r\n  \"NEventsListener\": 1,\r\n  \"CPUShares\": true,\r\n  \"RuncCommit\": {\r\n    \"Expected\": \"54296cf40ad8143b62dbcaa1d90e520a2136ddfe\",\r\n    \"ID\": \"54296cf40ad8143b62dbcaa1d90e520a2136ddfe\"\r\n  }\r\n}\r\n{\r\n  \"KernelVersion\": \"4.9.27-moby\",\r\n  \"Arch\": \"amd64\",\r\n  \"BuildTime\": \"2017-03-24T00:00:50.070226199+00:00\",\r\n  \"ApiVersion\": \"1.27\",\r\n  \"Version\": \"17.03.1-ce\",\r\n  \"MinAPIVersion\": \"1.12\",\r\n  \"GitCommit\": \"c6d412e\",\r\n  \"Os\": \"linux\",\r\n  \"GoVersion\": \"go1.7.5\"\r\n}\r\n```\r\n##### SUMMARY\r\n<!--- Explain the problem briefly -->\r\nThe `ansible_env.ANSIBLE_CONTAINER` variable is not defined.\r\n\r\n##### STEPS TO REPRODUCE\r\n<!---\r\nFor bugs, show exactly how to reproduce the problem.\r\nFor new features, show how the feature would be used.\r\n-->\r\n\r\n<!--- Paste any example commands between quotes below -->\r\n```\r\nansible-container --debug build --roles-path roles --no-cache\r\n```\r\n\r\n<!--- You can also paste gist.github.com links for larger files -->\r\n\r\n##### EXPECTED RESULTS\r\n<!--- What did you expect to happen when running the steps above? -->\r\nI would have expected that the variable `ansible_env.ANSIBLE_CONTAINER` would be defined as described in #222. This also used to work with ansible-container versions < 0.4.\r\n\r\n##### ACTUAL RESULTS\r\n<!--- What actually happened? If possible run with debugging (--debug) -->\r\n\r\n<!--- Paste verbatim command output between quotes below -->\r\n```\r\nTASK [foo : debug] *************************************************************\r\ntask path: /private/tmp/test/roles/foo/tasks/main.yml:2\r\nfatal: [bar]: FAILED! => {\r\n    \"failed\": true,\r\n    \"msg\": \"the field 'args' has an invalid value, which appears to include a variable that is undefined. The error was: 'dict object' has no attribute 'ANSIBLE_CONTAINER'\\n\\nThe error appears to have been in '/private/tmp/test/roles/foo/tasks/main.yml': line 2, column 3, but may\\nbe elsewhere in the file depending on the exact syntax problem.\\n\\nThe offending line appears to be:\\n\\n---\\n- debug: msg={{ ansible_env.ANSIBLE_CONTAINER }}\\n  ^ here\\nWe could be wrong, but this one looks like it might be an issue with\\nmissing quotes.  Always quote template expression brackets when they\\nstart a value. For instance:\\n\\n    with_items:\\n      - {{ foo }}\\n\\nShould be written as:\\n\\n    with_items:\\n - \\\"{{ foo }}\\\"\\n\"\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"HackerMD"}}