Image creation using a private repository on-prem

Skip to first unread message

Christopher Bachmeyer

Nov 4, 2021, 3:04:17 PM11/4/21
to Packer
hey group members, 

I am attempting to create a Linux image in AWS using privately hosted Linux repos that are on-prem.  All access to the outside has been cut off in AWS.  I need to use the Ansible-local provisioner as the Ansible remote version simply does not work.  When using the Ansible remote provisioner, Ansible seems to be able to talk to the instance and runs through its tasks but there are no changes made.  I'm not sure what is going on there.  

Anyways, to use Ansible locally, I need to connect to our on-prem repositories in order to pull down the necessary packages and such.  Does anyone known how to do this?  Should I use the shell provisioner and run a wget command to our mirror?  

Thanks much! 

Christopher Bachmeyer

Nov 11, 2021, 3:43:24 PM11/11/21
to Packer
In case anyone was curious, this was solved in two basic steps.  I wrote a simple shell script to add our nameservers to the resolv.conf and in turn execute it 
by using the Packer shell provisioner.  The second set was to use the Packer shell provisioner, again, to execute a bunch of one-liners using the "inline": parameter 
to move the existing repos to the "yum.repos.dislabled" directory and then use wget to download and load our mirror.  This allowed me to install Ansible successfully. 

"sudo wget https://repo.<your_business>.com/download/<your_mirror>.repo",

"sudo yum clean all",

"sudo yum repolist",

"sudo yum install -y ansible"

Reply all
Reply to author
0 new messages