Nux is using cloud-init to do it in his templates, see here:
https://github.com/NuxRo/openvm/blob/master/kickstarts/vanilla/7/post_cloudstack.ks

-- 
Erik

On Thu, Sep 3, 2015 at 9:20 AM, <christian.kir...@zv.fraunhofer.de> wrote:

> Hi,
>
> I encountered a similar issues, although I'm still not quite as far as you
> building a systemd script.
> I also changed the script to the right directory for the lease files.
> When the vm starts it takes approximately 15 minutes to be ready, that
> must have something to do with the script, but I’m not quiet sure if it is
> the password script or the ssh key script, which I also installed in the
> template.
> In the next couple days I’ll take some time for that script, maybe I get
> some steps further.
>
> If someone has already the solution, it would be great.
>
> Kind Regards
> Christian
>
> > On 03 Sep 2015, at 08:59, Indra Pramana <in...@sg.or.id> wrote:
> >
> > Dear all,
> >
> > Anyone has tried creating CentOS 7 OS template in CloudStack and
> > experiencing similar problem?
> >
> > Thank you.
> >
> > -ip-
> >
> >
> > On Wed, Sep 2, 2015 at 1:25 PM, Indra Pramana <in...@sg.or.id> wrote:
> >
> >> Dear all,
> >>
> >> I am using ACS 4.2.0 with KVM hypervisor. I am trying to create a
> CentOS 7
> >> template and everything is running fine except the CloudStack password
> >> reset script template.
> >>
> >> CentOS 7 is using systemd so I have created the required
> >> /usr/lib/systemd/system/cloud-set-guest-password.service as follows:
> >>
> >> ===
> >> [Unit]
> >> Description=Cloudstack set guest password
> >> After=network.target
> >>
> >> [Service]
> >> Type=oneshot
> >> User=root
> >> Group=root
> >> ExecStart=/etc/init.d/cloud-set-guest-password start
> >> Type=forking
> >>
> >> [Install]
> >> WantedBy=multi-user.target
> >> ===
> >>
> >> I also modified the /etc/init.d/cloud-set-guest-password slightly since
> >> CentOS 7 is using NetworkManager by default:
> >>
> >> ===
> >> # Add your DHCP lease folders here
> >> DHCP_FOLDERS="/var/lib/NetworkManager/*"
> >> ===
> >>
> >> The script is running perfectly fine if I run it manually. However, it
> >> doesn't seem to be started automatically upon boot-up even though I have
> >> enable it via systemctl.
> >>
> >> ===
> >> [root@test-centos7-20150819 ~]# systemctl enable
> >> cloud-set-guest-password.service
> >> ln -s '/usr/lib/systemd/system/cloud-set-guest-password.service'
> >>
> '/etc/systemd/system/multi-user.target.wants/cloud-set-guest-password.service'
> >>
> >> [root@test-centos7-20150819 ~]# systemctl status
> >> cloud-set-guest-password.service
> >> cloud-set-guest-password.service - Cloudstack set guest password
> >>   Loaded: loaded
> >> (/usr/lib/systemd/system/cloud-set-guest-password.service; enabled)
> >>   Active: inactive (dead)
> >> ===
> >>
> >> Anyone has similar experience before? How to ensure that the script can
> be
> >> executed during boot-up so that the password will be changed?
> >>
> >> Thanks in advance.
> >>
> >> -ip-
> >>
>
>

Reply via email to