Tobias Urdin db1629dc97 Use become for packages in upload-puppetforge
The upload-puppetforge role when executed as a
unprivileged user fails to install system packages
and the gems in the system gem home, see failure [1].

This adds become to the calls so that it becomes the
privileged user and executes these which will make them
have system access like the bindep role [2].

[1] http://logs.openstack.org/61/617ffad84b633618490ca1023f8a31d9694b31a9/release/release-openstack-puppet/c6e519d/job-output.txt.gz#_2019-01-21_20_53_17_207155
[2] https://git.openstack.org/cgit/openstack-infra/zuul-jobs/tree/roles/bindep/tasks/packages.yaml#n6

Change-Id: I4f11319727a4a5694f11abad4ded69ee554326f2
2019-01-21 22:14:35 +01:00

53 lines
1.3 KiB
YAML

- name: Install ruby dependencies on RedHat/Suse based
package:
name:
- ruby-devel
- gcc-c++
- make
state: present
become: yes
when: ansible_os_family == "RedHat" or ansible_os_family == "Suse"
- name: Install ruby dependencies on Debian based
package:
name:
- ruby-dev
- g++
- make
state: present
become: yes
when: ansible_os_family == "Debian"
- name: Install required gems
gem:
name: "{{ item }}"
user_install: no
with_items:
- rake
- puppetlabs_spec_helper
- puppet-blacksmith
become: yes
# NOTE(tobias.urdin): The build task is needed because puppet-blacksmith
# doesn't provide a build task so it fails, we don't need one anyway since
# we have already built the module before this role is called.
- name: Install new Rakefile
copy:
content: |
namespace 'module' do
task 'build' do
end
end
require 'puppet_blacksmith/rake_tasks'
dest: "{{ puppet_module_dir }}/Rakefile"
- name: Publish puppet module
command: "rake module:push"
args:
chdir: "{{ puppet_module_dir }}"
environment:
BLACKSMITH_FORGE_URL: "{{ blacksmith_forge_url }}"
BLACKSMITH_FORGE_USERNAME: "{{ blacksmith_forge_username }}"
BLACKSMITH_FORGE_PASSWORD: "{{ blacksmith_forge_password }}"