-1

What can be the issue on the task file?

this role should do this:

  1. add apt key for vscodium

  2. add vscodium repository

  3. install vscodium

When i want use ansible $ansible-playbook /etc/ansible/ubuntu_real.yml this error is show:

heavy  ~  ansible-playbook /etc/ansible/ubuntu_real.yml
 [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

 [WARNING]: Ignoring invalid attribute: repo

 [WARNING]: Ignoring invalid attribute: state


PLAY [localhost] **************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ********************************************************************************************************************************************************************************************
ok: [localhost]

TASK [ubuntu_real : Add an Apt signing key for vscodium] **********************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Unsupported parameters for (apt_key) module: become, become_method Supported parameters include: data, file, id, key, keyring, keyserver, state, url, validate_certs"}
 [WARNING]: Could not create retry file '/etc/ansible/ubuntu_real.retry'.         [Errno 13] Permission denied: u'/etc/ansible/ubuntu_real.retry'


PLAY RECAP ********************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1  

tasks file for /etc/ansible/roles/ubuntu_real contain error apt_key

---
# tasks file for /etc/ansible/roles/ubuntu_real

################################################################
# Resouces
################################################################
# install apt 
# https://docs.ansible.com/ansible/latest/modules/apt_module.html
# add apt_repository
# https://docs.ansible.com/ansible/latest/modules/apt_repository_module.html
################################################################


################################################################
# Vscodium
################################################################
- name: Add an Apt signing key for vscodium
  apt_key:
    url: https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg
    state: present
    become: yes
    become_method: "sudo"

# vscodium add repo
- apt_repository:
  repo: deb https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/repos/debs/ vscodium main
  state: present
  become: yes
  become_method: "sudo"

- name: install vscodium
  apt:
    name: vscodium
    update_cache: yes
    become: yes
    become_method: "sudo"
################################################################

file for run role /etc/ansible/ubuntu_real.yml

---
- hosts: localhost
  connection: local
  roles:
  - ubuntu_real

heavyblack1
  • 72
  • 2
  • 9

1 Answers1

0

Unsupported parameters for (apt_key) module: become, become_method

Supported parameters include: data, file, id, key, keyring, keyserver, state, url, validate_certs

Is because become: is a Task keyword, and not a module keyword. You have mis-indented your yaml; it should be:

- name: Add an Apt signing key for vscodium
  apt_key:
    url: https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg
    state: present
  become: yes
  become_method: "sudo"
mdaniel
  • 31,240
  • 5
  • 55
  • 58
  • thanks for your answer i am new to ansible and now role start but stil role can't add repository i folow guide how to add repo and this not working https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo more in comment below – heavyblack1 Jun 17 '19 at 15:54