2013-12-16 3 views
1

나는 내 VM과 함께로드있어 다음 클라우드 init 스크립트가 있습니다사용자 생성

#cloud-config 
# Add groups to the system 
# The following example adds the ubuntu group with members foo and bar and 
# the group cloud-users. 
groups: 
    - ugroup 

# Add users to the system. Users are added after groups are added. 
users: 
    - default 
    - name: user 
    gecos: Testbed as a Service 
    primary-group: ugroup 
    groups: admin 
    passwd: $6$rounds=4096$4pFvtqM5ldfLzR0hE9r7XSOoCO22lN7OB49IopWQ7SQrB5GBTR8X8okMpxXXQZ0jqUOuy4wKY.iYzwQTo7vH6zKx0DqjTFe6jh1 

runcmd: 
    - [passwd, user, '-u'] 

을하지만 내가

내가 얻을 수 있기 때문에 잘못된 soemthing하고 있어요 솔기 다음 오류 :

passwd: user 'user' does not exist 
run-parts: /var/lib/cloud/instance/scripts/runcmd exited with return code 1 
2013-12-16 15:15:09,028 - cc_scripts_user.py[WARNING]: failed to run-parts in /var/lib/cloud/instance/scripts 
2013-12-16 15:15:09,087 - __init__.py[WARNING]: Traceback (most recent call last): 
    File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/__init__.py", line 108, in run_cc_modules 
    cc.handle(name, run_args, freq=freq) 
    File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/__init__.py", line 72, in handle 
    [ name, self.cfg, self.cloud, cloudinit.log, args ]) 
    File "/usr/lib/python2.7/dist-packages/cloudinit/__init__.py", line 309, in sem_and_run 
    func(*args) 
    File "/usr/lib/python2.7/dist-packages/cloudinit/CloudConfig/cc_scripts_user.py", line 27, in handle 
    util.runparts(runparts_path) 
    File "/usr/lib/python2.7/dist-packages/cloudinit/util.py", line 140, in runparts 
    raise subprocess.CalledProcessError(sp.returncode,cmd) 
CalledProcessError: Command '['run-parts', '--regex', '.*', '/var/lib/cloud/instance/scripts']' returned non-zero exit status 1 

2013-12-16 15:15:09,100 - __init__.py[ERROR]: config handling of scripts-user, None, [] failed 

문제점에 대한 유용한 팁이나 해결책이 있습니까?

+0

"taas"가 아닌 "user"사용자를 추가하는 것처럼 보입니다. –

+0

죄송합니다. 저는 텍스트를 편집 중이었고이 이미지를 건너 뛰었습니다. 문제는 이미지가 생성 된 곳의 네트워크가 cloud-init 서비스/apis에 액세스하지 못했습니다. – VicoMan

답변

1

이 질문은 매우 오래된 것이지만 현재 16.04 우분투 이미지에서 올바르게 작동하는지 확인하기 위해 테스트를 실행했습니다.

lxd은 매우 신속하게 인스턴스를 만들고 클라우드 초기화 구성을 테스트하는 데 사용할 수 있습니다. 당신이 이미 설정 LXD 한 가정, 내가 그랬어 :

$ cat ud.yaml 
#cloud-config 
# Add groups to the system 
# The following example adds the ubuntu group with members foo and bar and 
# the group cloud-users. 
groups: 
    - ugroup 

# Add users to the system. Users are added after groups are added. 
users: 
    - default 
    - name: user 
    gecos: Testbed as a Service 
    primary-group: ugroup 
    groups: admin 
    passwd: $6$rounds=4096$4pFvtqM5ldfLzR0hE9r7XSOoCO22lN7OB49IopWQ7SQrB5GBTR8X8okMpxXXQZ0jqUOuy4wKY.iYzwQTo7vH6zKx0DqjTFe6jh1 

runcmd: 
    - [passwd, user, '-u'] 

$ lxc launch ubuntu-daily:xenial xuser-test \ 
    "--config=user.user-data=$(cat ud.yaml)" 

$ lxc exec xuser-test /bin/bash 

# ls -l /home/ 
total 2 
drwxr-xr-x 3 ubuntu ubuntu 6 Jul 18 18:47 ubuntu 
drwxr-xr-x 2 user ugroup 5 Jul 18 18:47 user 

# tail -n 2 /etc/group 
ugroup:x:1000: 
ubuntu:x:1001: 

# tail -n 2 /etc/passwd 
ubuntu:x:1000:1001:Ubuntu:/home/ubuntu:/bin/bash 
user:x:1001:1000:Testbed as a Service:/home/user: 

# grep passwd /var/log/cloud-init-output.log 
passwd: password expiry information changed. 

를이 여전히 클라우드 초기화에 대한 file a bug 당신을 위해 문제하시기 바랍니다 경우.