<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">gce module<br>
gce_metadata module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.5.0b1
  config file = /work/ansible/git/ansible/ansible.cfg
  configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /work/ansible/virt-2.7/lib/python2.7/site-packages/ansible
  executable location = /work/ansible/virt-2.7/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
"><pre class="notranslate"><code class="notranslate">ansible 2.5.0b1
  config file = /work/ansible/git/ansible/ansible.cfg
  configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /work/ansible/virt-2.7/lib/python2.7/site-packages/ansible
  executable location = /work/ansible/virt-2.7/bin/ansible
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]

</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">ANSIBLE_PIPELINING(/work/ansible/git/ansible/ansible.cfg) = True<br>
CACHE_PLUGIN(/work/ansible/git/ansible/ansible.cfg) = jsonfile<br>
CACHE_PLUGIN_CONNECTION(/work/ansible/git/ansible/ansible.cfg) = /work/ansible/cache<br>
CACHE_PLUGIN_TIMEOUT(/work/ansible/git/ansible/ansible.cfg) = 86400<br>
DEFAULT_FORKS(/work/ansible/git/ansible/ansible.cfg) = 25<br>
DEFAULT_GATHERING(/work/ansible/git/ansible/ansible.cfg) = smart<br>
DEFAULT_REMOTE_USER(/work/ansible/git/ansible/ansible.cfg) = ansible<br>
DEFAULT_ROLES_PATH(/work/ansible/git/ansible/ansible.cfg) = [u'/work/ansible/git/ansible/roles']<br>
PERSISTENT_CONNECT_TIMEOUT(/work/ansible/git/ansible/ansible.cfg) = 30<br>
RETRY_FILES_ENABLED(/work/ansible/git/ansible/ansible.cfg) = False</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">LSB Version:    :core-4.1-amd64:core-4.1-noarch<br>
Distributor ID: CentOS<br>
Description:    CentOS Linux release 7.4.1708 (Core)<br>
Release:        7.4.1708<br>
Codename:       Core</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">There is currently no gce module to directly manage metadata within gce.<br>
Metadata management is enabled within the gce module, but it cannot be changed or used except when creating an instance.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">Utilize it as a simple module with fields for required information to interact with GCE and then another field with metadata, populated with the same hash/dictionary data as the gce module.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="      gce_metadata:
        instance_name: example1
        zone: us-central1-a
        state: present
        service_account_email: &quot;{{ service_account_email }}&quot;
        credentials_file: &quot;{{ credentials_file }}&quot;
        project_id: &quot;{{ project_id }}&quot;
        metadata : '{ &quot;key1&quot; : &quot;value1&quot;,&quot;key2&quot; : &quot;value2&quot;, &quot;key3&quot; : &quot;value3&quot; }'"><pre class="notranslate"><code class="notranslate">      gce_metadata:
        instance_name: example1
        zone: us-central1-a
        state: present
        service_account_email: "{{ service_account_email }}"
        credentials_file: "{{ credentials_file }}"
        project_id: "{{ project_id }}"
        metadata : '{ "key1" : "value1","key2" : "value2", "key3" : "value3" }'
</code></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">The expected results would be to set/confirm metadata fields provided within the module on a GCE instance.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">Currently this is not something that can be done with ansible, if attempting to use the gce module you cannot just interact with metadata unless you configure all other options to match the current instance setup, which takes most possibilities of automation out of the use case.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate">
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Feature Request</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">module: yum</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.2.0
  config file = /ifs/ansible.cfg
  configured module search path = [u'/opt/ansible/ansible_boot/.virtenv/ifs/lib/python2.7/site-packages/ansible/modules', u'/ifs/library']
  python version = 2.7.5 (default, Oct 11 2015, 17:47:16) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]"><pre class="notranslate"><code class="notranslate">ansible 2.3.2.0
  config file = /ifs/ansible.cfg
  configured module search path = [u'/opt/ansible/ansible_boot/.virtenv/ifs/lib/python2.7/site-packages/ansible/modules', u'/ifs/library']
  python version = 2.7.5 (default, Oct 11 2015, 17:47:16) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">RHEL7 &amp; RHEL7</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">When upgrading the packages, even if yum/dracut can't build the kernel initramfs due to too not enough space in <code class="notranslate">/boot</code>, the command completes successfully. This is revealed on reboot, as the kernel panics because no initramfs was built.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">As long as the <code class="notranslate">/boot</code> partition is too small to build a new kernel initramfs for the newly installed kernel, yum will show dracut failing, ansible will not fail the task.</p>

<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- hosts: all
  tasks:
        
    - name: (pre_event) Free space in /boot partition is greater than 40MB
      shell: df -P /boot | grep -e &quot;^/dev&quot; | tr -s ' ' | cut -d ' ' -f 4
      register: boot_partition_space
      # 40MB
      failed_when: boot_partition_space.stdout|int &gt;= 40000

    # Kernel has to be an update - else name=kernel
    - name: (pre_event) Update all packages on the system
      yum:
        name: '*'
        state: latest"><pre class="notranslate">- <span class="pl-ent">hosts</span>: <span class="pl-s">all</span>
  <span class="pl-ent">tasks</span>:
        
    - <span class="pl-ent">name</span>: <span class="pl-s">(pre_event) Free space in /boot partition is greater than 40MB</span>
      <span class="pl-ent">shell</span>: <span class="pl-s">df -P /boot | grep -e "^/dev" | tr -s ' ' | cut -d ' ' -f 4</span>
      <span class="pl-ent">register</span>: <span class="pl-s">boot_partition_space</span>
      <span class="pl-c"><span class="pl-c">#</span> 40MB</span>
      <span class="pl-ent">failed_when</span>: <span class="pl-s">boot_partition_space.stdout|int &gt;= 40000</span>

    <span class="pl-c"><span class="pl-c">#</span> Kernel has to be an update - else name=kernel</span>
    - <span class="pl-ent">name</span>: <span class="pl-s">(pre_event) Update all packages on the system</span>
      <span class="pl-ent">yum</span>:
        <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">'</span>*<span class="pl-pds">'</span></span>
        <span class="pl-ent">state</span>: <span class="pl-s">latest</span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<p dir="auto">The second task should fail when dracut fails to build the kernel initramfs</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">After the following script runs, and a reboot is issued, the server cannot boot up, as it always encounters a kernel panic.</p>

<p dir="auto">Stdout:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[...]
  Cleanup    : ncurses-base-5.9-13.20130511.el7.noarch                1012/1013
  Cleanup    : libgcc-4.8.5-11.el7.x86_64                                          1013/1013
2661 blocks

gzip: stdout: No space left on device
dracut: creation of /boot/initramfs-3.10.0-693.2.2.el7.x86_64.img failed
mkinitrd failed
warning: %posttrans(kernel-3.10.0-693.2.2.el7.x86_64) scriptlet failed, exit status 1
Uploading Package Profile
  Verifying  : zlib-1.2.7-17.el7.i686                                                1/1013
  Verifying  : yum-rhn-plugin-2.0.1-9.el7.noarch                         2/1013
[...]"><pre class="notranslate"><code class="notranslate">[...]
  Cleanup    : ncurses-base-5.9-13.20130511.el7.noarch                1012/1013
  Cleanup    : libgcc-4.8.5-11.el7.x86_64                                          1013/1013
2661 blocks

gzip: stdout: No space left on device
dracut: creation of /boot/initramfs-3.10.0-693.2.2.el7.x86_64.img failed
mkinitrd failed
warning: %posttrans(kernel-3.10.0-693.2.2.el7.x86_64) scriptlet failed, exit status 1
Uploading Package Profile
  Verifying  : zlib-1.2.7-17.el7.i686                                                1/1013
  Verifying  : yum-rhn-plugin-2.0.1-9.el7.noarch                         2/1013
[...]
</code></pre></div>
<p dir="auto">From our custom logging callback plugin:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  &quot;changed&quot;: true,
  &quot;msg&quot;: &quot;Warning: RPMDB altered outside of yum.\n** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:\nkatello-ca-consumer-rhelsatsy01exdu.ent.oclc.org-1.0-12.noarch is a duplicate with katello-ca-consumer-rhelsatsy01exdu.ent.oclc.org-1.0-7.noarch\nNon-fatal POSTTRANS scriptlet failure in rpm package kernel-3.10.0-693.2.2.el7.x86_64\n&quot;,
  &quot;rc&quot;: 0,"><pre class="notranslate"><code class="notranslate">  "changed": true,
  "msg": "Warning: RPMDB altered outside of yum.\n** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:\nkatello-ca-consumer-rhelsatsy01exdu.ent.oclc.org-1.0-12.noarch is a duplicate with katello-ca-consumer-rhelsatsy01exdu.ent.oclc.org-1.0-7.noarch\nNon-fatal POSTTRANS scriptlet failure in rpm package kernel-3.10.0-693.2.2.el7.x86_64\n",
  "rc": 0,
</code></pre></div>
<p dir="auto">So even though the return code is 0 for the yum command, - I would appreciate if the yum module would be able to catch this.</p>