#ansible (2020-04)


Discussions related to ansible configuration management



Vikram Yerneni avatar
Vikram Yerneni

Fellas, Ansible job for Prometheus helm chart with Ingress Annotation is throwing this weird error:

    "stderr_lines": [
        "Error: failed to parse /tmp/my_values_prom.yaml: error converting YAML to JSON: yaml: line 652: did not find expected alphabetic or numeric character"

and this is the line 652:

651.    annotations:
652.       kubernetes.io/ingress.class: 'alb'
Vikram Yerneni avatar
Vikram Yerneni

Anyone been through this error before??

Vikram Yerneni avatar
Vikram Yerneni

Fixed the lint in the annotations



Abel Luck avatar
Abel Luck

@ikar haven’t gotten back to that client to test it yet, but will soon!

Brij S avatar
Brij S

Hi all, I’m attempting to encrypt an s3 bucket and then encrypt all the contents in the bucket given a list of bucket. I’ve got the following

- name: "S3 bucket encryption"
  hosts: localhost
  connection: local 
      - test
  - name: encrypt S3 bucket
      name: "{{ item }}"
      encryption: AES256
      state: present
    with_items: "{{ buckets }}"
    ignore_errors: true

  - name: obtain list of all objects in bucket
      bucket: "{{ item }}"
      object: /
      mode: list
    with_items: "{{ buckets }}"
    register: bucket_item_list
    ignore_errors: true

  - name: encrypt all objects in bucket
      bucket: "{{ item.item }}"
      object: "{{ item.s3_keys }}"
      src: "{{ item.s3_keys }}"
      encrypt: yes
      encryption_mode: AES256
      mode: put
    with_items: "{{ bucket_item_list.results }}"
    ignore_errors: true

However, the last step results in the following error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: expected str, bytes or os.PathLike object, not list
fatal: [localhost]: FAILED! => {"msg": "Unexpected failure during module execution.", "stdout": ""}

Any ideas as to why its complaining about a list? I assume the with_items will loop through the list

Abel Luck avatar
Abel Luck

I suspect bucket_item_list.results is incorrect.

Add a:

- debug:
    var: bucket_item_list

After the ‘obtain list of all objects in bucket’ step and see what the output of that step is


Abel Luck avatar
Abel Luck

No bites?

ikar avatar
   - name: launch new ec2 instances                                            
     local_action: ec2                                                         
                   volumes=[ { device_name: "/dev/sda1", volume_size: 16, volume_type: gp2, delete_on_termination: True } ]

this doesn’t work?

ikar avatar

maybe switch /dev/sda1 with your device name?

ikar avatar

^^ @Abel Luck


Abel Luck avatar
Abel Luck

Does anyone know how to use the ec2_instance ansible module to create an instance with an nvme root volume with a custom size?

Abel Luck avatar
Abel Luck

This is using t3.* instances