On 7/24/19 10:17 PM, Keith Mills wrote: > I have my playbook for CPAN. Right now it only works for Debian. I need it to > work for SLES/RHEL/UBUNTU also but I don't > know how to add them into the playbook. Can someone please help! > >
Please check the tasks below. Tested on: - Debian 9 and Debian 10 - CentOS 7 - Ubuntu Bionic (symlink /usr/bin/python3 or set ansible_python_interpreter inventory variable) - OpenSuSE 15 Notes: - notest is true as the @INC dot removal broke a couple of Perl modules - additional prerequisites might be needed for XS modules, e.g. https://wiki.linuxia.de/library/stefan-hornburg-racke-perl-tricks-en#text-amuse-label-debianprequisites - split up the OS specific tasks into separate task files and include them Let me know if you have any questions. Regards Racke --- - hosts: all become: yes tasks: - name: Install cpanm on Debian/Ubuntu apt: name: cpanminus when: ansible_os_family == 'Debian' - name: Install other prerequisites (Debian) apt: name: - gcc - make when: ansible_os_family == 'Debian' - name: Install cpanm on RedHat yum: name: perl-App-cpanminus when: ansible_os_family == 'RedHat' - name: Install other prerequisites (RedHat) yum: name: - gcc - make when: ansible_os_family == 'RedHat' - name: Install cpanm (SUSE Linux) zypper: name: perl-App-cpanminus when: ansible_os_family == 'Suse' - name: Install other prerequisites (SUSE Linux) yum: name: - gcc - make when: ansible_os_family == 'Suse' - name: Install some CPAN modules cpanm: name: "{{ item }}" notest: true with_items: - DBIx::Class - DateTime - Dancer2 > What I have: > > cpan-modules.yaml > > --- > - hosts: gen10alltools > remote_user: root > > # Note: I am testing this script > # The intended result is to increase speed to deploy new servers > # by installing the needed CPAN modules through Ansible instead > # of the old scripts from Build Admin. Copying requirements from: > # E:\BuildAgent\buildagent\linux\matrix_update\12-cpan\SLES-12-x86_64.sh > > tasks: > - name: copy MyConfig.pm to the correct directory on remote host(s) > template: > src: ../../../library/conf/debian/debian-myconfig.pm > dest: /root/.cpan/CPAN/MyConfig.pm > # - name: install CPANM so the next step can install all modules > # zypper: > # name: perl-App-cpanminus > # state: present > # Commented out the CPANM install because it...doesn't work right, > # did manually by executing "cpan App::cpanminus" from our mirror > # install needed CPAN modules > # - cpanm: name={{ item }} > - cpanm: > name: "{{ item }}" > with_items: > - "HTTP::DAV" > - "Log::Log4perl" > - "SOAP::Lite" > - "Digest::SHA1" > - "AnyData" > - "Log::Dispatch::FileRotate" > - "Term::Shell" > - "Crypt::RC4" > environment: > PERL_CPANM_OPT: "--mirror http://hCPAN2.sde.rdlabs.hpecorp.net/" > ... > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to > [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/31ae91af-9d54-445c-8e1b-b583d284569c%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/31ae91af-9d54-445c-8e1b-b583d284569c%40googlegroups.com?utm_medium=email&utm_source=footer>. -- Ecommerce and Linux consulting + Perl and web application programming. Debian and Sympa administration. Provisioning with Ansible. -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9724b426-b7cd-31d5-a67c-705f942645c8%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
