diff --git a/foreman/defaults/main.yml b/foreman/defaults/main.yml new file mode 100644 index 0000000..e3839b8 --- /dev/null +++ b/foreman/defaults/main.yml @@ -0,0 +1,14 @@ +--- +# foreman PKG state: latest, installed, absent +foreman_pkg_state: latest +foreman_repos: + - 'deb http://deb.theforeman.org/ trusty 1.10' + - 'deb http://deb.theforeman.org/ plugins 1.10' + +foreman_repo_key: 'http://deb.theforeman.org/pubkey.gpg' + +foreman_puppetlabs_repo_pkg: 'puppetlabs-release-{{ ansible_distribution_release }}.deb' +foreman_puppetlabs_repo_url: 'https://apt.puppetlabs.com/{{ foreman_puppetlabs_repo_pkg }}' + +foreman_ansible_plugin: + - ruby-foreman-ansible diff --git a/foreman/tasks/foreman-packages.yml b/foreman/tasks/foreman-packages.yml new file mode 100644 index 0000000..9b23781 --- /dev/null +++ b/foreman/tasks/foreman-packages.yml @@ -0,0 +1,33 @@ +--- +- name: Download the puppetlabs repo package + get_url: url='{{ foreman_puppetlabs_repo_url }}' dest=/srv/{{ foreman_puppetlabs_repo_pkg }} + register: puppetlabs_repo + tags: foreman + +- name: Install the puppetlabs repo package + apt: deb=/srv/{{ foreman_puppetlabs_repo_pkg }} update_cache=yes + when: puppetlabs_repo | changed + tags: foreman + +- name: Add the foreman repo keys + apt_key: url='{{ foreman_repo_key }}' state=present + +- name: Add the foreman repos + apt_repository: repo='{{ item }}' update_cache=yes + with_items: '{{ foreman_repos }}' + tags: foreman + +- name: Install the ansible foreman plugin + apt: pkg={{ item }} state={{ foreman_pkg_state }} + with_items: '{{ foreman_ansible_plugin }}' + tags: foreman + +- name: Install the foreman installer + apt: pkg=foreman-installer state={{ foreman_pkg_state }} + register: foreman_installer_pkg + tags: foreman + +- name: Run the foremann installer + shell: foreman-installer + when: foreman_installer_pkg | changed + tags: foreman diff --git a/foreman/tasks/main.yml b/foreman/tasks/main.yml new file mode 100644 index 0000000..ad5671e --- /dev/null +++ b/foreman/tasks/main.yml @@ -0,0 +1,3 @@ +--- +- include: foreman-packages.yml + diff --git a/openjdk/tasks/main.yml b/openjdk/tasks/main.yml index fb90c14..3ee2933 100644 --- a/openjdk/tasks/main.yml +++ b/openjdk/tasks/main.yml @@ -2,21 +2,17 @@ - name: Update the apt cache, if needed apt: update_cache=yes when: openjdk_pkg_state == 'latest' - tags: - - jdk + tags: jdk - name: install OpenJDK JRE apt: pkg=openjdk-{{ item.0 }}-{{ item[1] }} state={{ openjdk_pkg_state }} with_nested: - - openjdk_version + - '{{ openjdk_version }}' - [ 'jre', 'jre-headless', 'jdk' ] - notify: - Set the default OpenJDK - tags: - - jdk + notify: Set the default OpenJDK + tags: jdk - name: Set fact jdk_installed set_fact: jdk_installed=true - tags: - - jdk + tags: jdk