{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/25033","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/25033/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/25033/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/25033/events","html_url":"https://github.com/ansible/ansible/issues/25033","id":231368446,"number":25033,"title":"[parted] module parted fails if partition has lvm volumes","user":{"login":"zunkree","id":912534,"avatar_url":"https://avatars1.githubusercontent.com/u/912534?v=3","gravatar_id":"","url":"https://api.github.com/users/zunkree","html_url":"https://github.com/zunkree","followers_url":"https://api.github.com/users/zunkree/followers","following_url":"https://api.github.com/users/zunkree/following{/other_user}","gists_url":"https://api.github.com/users/zunkree/gists{/gist_id}","starred_url":"https://api.github.com/users/zunkree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zunkree/subscriptions","organizations_url":"https://api.github.com/users/zunkree/orgs","repos_url":"https://api.github.com/users/zunkree/repos","events_url":"https://api.github.com/users/zunkree/events{/privacy}","received_events_url":"https://api.github.com/users/zunkree/received_events","type":"User","site_admin":false},"labels":[{"id":454885231,"url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.3","name":"affects_2.3","color":"5319e7","default":false},{"id":48276055,"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04","default":false},{"id":496359346,"url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":503572087,"url":"https://api.github.com/repos/ansible/ansible/labels/needs_triage","name":"needs_triage","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-05-25T15:13:08Z","updated_at":"2017-05-25T15:20:13Z","closed_at":null,"body":"##### ISSUE TYPE\r\n - Bug Report\r\n\r\n##### COMPONENT NAME\r\nparted\r\n\r\n##### ANSIBLE VERSION\r\n```\r\nansible 2.3.0.0\r\n  config file = /Users/zunkree/Projects/infrastructure/k8s.ringlabskiev.com/ansible.cfg\r\n  configured module search path = Default w/o overrides\r\n  python version = 2.7.13 (default, Dec 18 2016, 07:03:39) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]\r\n```\r\n\r\n##### CONFIGURATION\r\n```\r\n[defaults]\r\ninventory = /usr/local/bin/terraform-inventory\r\nretry_files_enabled = False\r\n\r\ngathering = smart\r\nfact_caching = jsonfile\r\nfact_caching_timeout = 86400\r\nfact_caching_connection = cachedir\r\n\r\nhost_key_checking = False\r\n```\r\n\r\n##### OS / ENVIRONMENT\r\nUbuntu 16.04 on AWS\r\n\r\n##### SUMMARY\r\nPartition has been created with previous run and lvm volume group/volumes has been created. Module fails next runs with message:\r\n```\r\nfatal: [XXX.XXX.XXX.XXX]: FAILED! => {\"changed\": false, \"err\": \"Error: Partition(s) 1 on /dev/xvdf have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\\n\", \"failed\": true, \"msg\": \"Error while running parted script: /sbin/parted -s -m -a optimal /dev/xvdf -- unit KiB mklabel gpt mkpart primary 0% 100%\", \"out\": \"\", \"rc\": 1}\r\n```\r\n\r\n##### STEPS TO REPRODUCE\r\nRun ansible again with such tasks\r\n```yaml\r\n---\r\n# tasks file for roles/etcd\r\n- name: create partition...\r\n  parted:\r\n    number: 1\r\n    label: gpt\r\n    flags: [ lvm ]\r\n    state: present\r\n    device: \"{{ storage_dev }}\"\r\n  become: yes\r\n\r\n- name: create volume group...\r\n  lvg:\r\n    vg: \"{{ storage_vg }}\"\r\n    pvs: \"{{ storage_pv }}\"\r\n  become: yes\r\n\r\n- name: create lvm volumes...\r\n  lvol:\r\n    vg: \"{{ storage_vg }}\"\r\n    lv: \"{{ item.name }}\"\r\n    size: \"{{ item.size }}\"\r\n  become: yes\r\n  with_items: \"{{ storage_lvol }}\"\r\n\r\n- name: make filesystems...\r\n  filesystem:\r\n    fstype: ext4\r\n    resizefs: yes\r\n    dev: \"/dev/{{ storage_vg }}/{{ item.name }}\"\r\n  become: yes\r\n  with_items: \"{{ storage_lvol }}\"\r\n\r\n- name: create mount directories...\r\n  file:\r\n    path: \"{{ item.mount }}\"\r\n    state: directory\r\n  become: yes\r\n  with_items: \"{{ storage_lvol }}\"\r\n\r\n- name: mount directories...\r\n  mount:\r\n    name: \"{{ item.mount }}\"\r\n    src: \"/dev/{{ storage_vg }}/{{ item.name }}\"\r\n    fstype: ext4\r\n    opts: defaults,relatime\r\n    state: mounted\r\n  become: yes\r\n  with_items: \"{{ storage_lvol }}\"\r\n```\r\ndefaults:\r\n```\r\nstorage_dev: /dev/xvdf\r\nstorage_pv: \"{{ storage_dev }}1\"\r\nstorage_vg: etcd00\r\nstorage_lvol:\r\n  - name: data\r\n    size: 2g\r\n    mount: '/var/lib/data'\r\n```\r\n\r\n##### EXPECTED RESULTS\r\nModule detects correctly created partition and works without errors.\r\n\r\n##### ACTUAL RESULTS\r\nModule fails with error:\r\n```\r\n<XXX.XXX.XXX.XXX> (0, '\\r\\n{\"rc\": 1, \"out\": \"\", \"err\": \"Error: Partition(s) 1 on /dev/xvdf have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\\\\n\", \"invocation\": {\"module_args\": {\"align\": \"optimal\", \"part_end\": \"100%\", \"flags\": [\"lvm\"], \"part_type\": \"primary\", \"device\": \"/dev/xvdf\", \"unit\": \"KiB\", \"part_start\": \"0%\", \"state\": \"present\", \"label\": \"gpt\", \"number\": 1, \"name\": null}}, \"failed\": true, \"msg\": \"Error while running parted script: /sbin/parted -s -m -a optimal /dev/xvdf -- unit KiB mklabel gpt mkpart primary 0% 100%\"}\\r\\n', 'Shared connection to XXX.XXX.XXX.XXX closed.\\r\\n')\r\nfatal: [XXX.XXX.XXX.XXX]: FAILED! => {\r\n    \"changed\": false,\r\n    \"err\": \"Error: Partition(s) 1 on /dev/xvdf have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.\\n\",\r\n    \"failed\": true,\r\n    \"invocation\": {\r\n        \"module_args\": {\r\n            \"align\": \"optimal\",\r\n            \"device\": \"/dev/xvdf\",\r\n            \"flags\": [\r\n                \"lvm\"\r\n            ],\r\n            \"label\": \"gpt\",\r\n            \"name\": null,\r\n            \"number\": 1,\r\n            \"part_end\": \"100%\",\r\n            \"part_start\": \"0%\",\r\n            \"part_type\": \"primary\",\r\n            \"state\": \"present\",\r\n            \"unit\": \"KiB\"\r\n        }\r\n    },\r\n    \"msg\": \"Error while running parted script: /sbin/parted -s -m -a optimal /dev/xvdf -- unit KiB mklabel gpt mkpart primary 0% 100%\",\r\n    \"out\": \"\",\r\n    \"rc\": 1\r\n}```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/304037649","html_url":"https://github.com/ansible/ansible/issues/25033#issuecomment-304037649","issue_url":"https://api.github.com/repos/ansible/ansible/issues/25033","id":304037649,"user":{"login":"ansibot","id":6585283,"avatar_url":"https://avatars3.githubusercontent.com/u/6585283?v=3","gravatar_id":"","url":"https://api.github.com/users/ansibot","html_url":"https://github.com/ansibot","followers_url":"https://api.github.com/users/ansibot/followers","following_url":"https://api.github.com/users/ansibot/following{/other_user}","gists_url":"https://api.github.com/users/ansibot/gists{/gist_id}","starred_url":"https://api.github.com/users/ansibot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ansibot/subscriptions","organizations_url":"https://api.github.com/users/ansibot/orgs","repos_url":"https://api.github.com/users/ansibot/repos","events_url":"https://api.github.com/users/ansibot/events{/privacy}","received_events_url":"https://api.github.com/users/ansibot/received_events","type":"User","site_admin":false},"created_at":"2017-05-25T15:20:13Z","updated_at":"2017-05-25T15:20:13Z","body":"cc @ColOfAbRiX\n[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)\n<!--- boilerplate: notify --->"}}
{"actor":{"display_login":"ansibot"}}